How can I tell the resolution of scanned PDF from within a shell script?

后端 未结 7 1915
猫巷女王i
猫巷女王i 2021-02-03 11:25

I have a large collection of documents scanned into PDF format, and I wish to write a shell script that will convert each document to DjVu format. Some documents were scanned a

7条回答
  •  天涯浪人
    2021-02-03 11:41

    Too long to put into a comment, but neither ImageMagick nor GraphicsMagic is up to the job; every answer is wrong:

    : nr@yorkie 1932 ; gm identify -format "x=%x y=%y w=%w h=%h" drh*rec*pdf
    x=0 y=0 w=612 h=792
    x=0 y=0 w=612 h=792
    x=0 y=0 w=612 h=792
    x=0 y=0 w=612 h=792
    x=0 y=0 w=612 h=792
    x=0 y=0 w=612 h=792
    x=0 y=0 w=612 h=792
    x=0 y=0 w=612 h=792
    
    : nr@yorkie 1933 ; identify -format "x=%x y=%y w=%w h=%h" drh*rec*pdf   
    x=72 Undefined y=72 Undefined w=612 h=792x=72 Undefined y=72 Undefined     w=612 h=792x=72 Undefined y=72 Undefined w=612 h=792x=72 Undefined     y=72 Undefined w=612 h=792x=72 Undefined y=72 Undefined w=612     h=792x=72 Undefined y=72 Undefined w=612 h=792x=72 Undefined y=72     Undefined w=612 h=792x=72 Undefined y=72 Undefined w=612 h=792
    : nr@yorkie 1934 ; 
    

    The correct parameters for this document is that each scanned page is 5100 pixels wide and 6600 pixels high, unsurprising for this was an 8.5-by-11 scanned at 600dpi. The output from ImageMagic is astoundingly unprofessional.

    No downvotes because you were trying to be helpful, but *Magick don't work.

提交回复
热议问题