Nijeesh Joshy
Nijeesh Joshy

Reputation: 1481

converting PDF with image magic leaving extra white space around

I am trying to convert .pdf files to .jpg using image-magic

convert -limit -limit map 300 -flatten -density 300 -quality 100 -crop '400x400+20+20' dummy.pdf[0] test.jpg

but the problem i am facing is when i convert the file, it cropping the area but marking all the other area as white.

for example if i am converting a pdf with 1000x1000 size and cropping it to a 100x100 size, the output am getting is an image with 1000x1000 size with 100x100 area croped from the pdf and rest is white space.

enter image description here

sample.pdf

i cannot use trim, since my pdf may or may not have white border and trim will remove it

Upvotes: 0

Views: 974

Answers (1)

fmw42
fmw42

Reputation: 53089

Your syntax is not in the proper order for Imagemagick. Most of the settings and operators need to come after reading the input PDF. Using Imagemagick 6.9.10.71 Q16 Mac OSX Sierra:

convert -limit map 300 -density 300 dummy.pdf[0] -background white -flatten -crop '400x400+20+20' -quality 100 test.jpg


enter image description here

Upvotes: 1

Related Questions