imagemagick - GraphicsMagick crop PDF -


i've got 8.5x11 pdf @ 300dpi. has single upc label in top left corner of pdf. imagine there 30 labels on 1 sheet, have 1 label.

i'm trying crop pdf size of 1 label. far i've got this

gm convert -density 300 single.pdf out.pdf 

which doesn't cropping. when crop 300x100 makes 20mb file 30000 pages.

i have not clue how use -crop crop correct size. need 3.5inches 1.125 inches.

using following input pdf (here converted png):

wiz.pdf

the following command crop label:

gm wiz.pdf -crop 180x50+1+1  cropped.pdf 

cropped.pdf

this label sized 180x50 pixels.

for 8.5x11in pdf @ 300 ppi you'd have 2450x3300 pixels pdf (which doubt do, that's question) , you'd need use -crop 1050x337+0+0 (more exactly, 1050x337.5+0+0 -- cannot crop half pixels!).

note, +0+0 part crops top left corner. if need offset right n pixels , bottom m pixels use +n+m...


using imagemagick instead...

you use imagemagick's convert command:

convert wiz.pdf[180x50+1+1] cropped.pdf 

comment image sizes...

one additional comment remark:

"i have not clue how use -crop crop correct size."

there no other real size raster images pixels. abc pixels wide , xyz pixels high...

there no such thing absolute, real size digital image can measure in inches... unless additionally can state resolution @ given image rendered on display or print device!

an 8.50x11in sized image @ 300 ppi translate 2550x3300 pixels. however, if image not contain amount of pixels (which real, absolute size of raster image), may still able render @ 300 ppi -- size in inches different 8.5x11in!

so, whenever want crop, use absolute number of pixels want. don't use resolution/density @ on command line!


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -