Help cropping pdf to pgm exporting only single crop section

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
indefinitedrums
Posts: 2
Joined: 2013-04-11T10:08:52-07:00
Authentication code: 6789

Help cropping pdf to pgm exporting only single crop section

Post by indefinitedrums »

Hello all, please forgive me if this is covered or if I just missed something, I did some extensive searching first, and couldnt find a solution...

I am trying to use convert to take the first page of a pdf, crop it to small box in the top left corner, and save it as a pgm... this is the command I am using

Code: Select all

convert.exe -density 150 doc.pdf[1] -crop 425x206 -density 150 out.pgm
this DOES indeed crop to the desired size, but with an odd side effect... it 'layers'(?) the rest of the page in 425x206 boxes behind the desired cropped image, so when I go to OCR out.pgm, the other "boxes" are read as well, making the crop useless!

I know I just must be missing something here, could someone point me in the right direction? Thank you in advance for any help
indefinitedrums
Posts: 2
Joined: 2013-04-11T10:08:52-07:00
Authentication code: 6789

Re: Help cropping pdf to pgm exporting only single crop sect

Post by indefinitedrums »

aaaaaaaaaaaaaaaaaaaaand as soon as I posted, I realized my mistake.... I needed to add 0+0 to my crop dimensions to exclude the rest of the page.

Code: Select all

convert.exe -density 150 doc.pdf[1] -crop 425x206+0+0 -density 150 out.pgm
My apologies, and thank you for such a powerful tool!
Post Reply