On Friday 21 January 2011 14:25:06 Michael Howard wrote:
> My issues relate to convert PDF -> JPG
> 
> 
> PROBLEM
> 
> Some of the .pdf files contain a mixture of 8.5x11 portrait pages and
> 11x17 landscape 2-page-spreads. I can confirm this by opening the
> files in Adobe Reader.
> 
> 
> Advice/recommendations from the IM gurus would be greatly appreciated.
> 

I currently use PerlMagick to automatically convert pdf files that have a wide 
mixture of orientations/formats into something that can not make a printer 
blow chunks.

What you are dealing with is familiar in part. My goal is to read them, 
identify any rotated pages/outsized pages, and rotate/resize/drop colors. (I 
have spreadsheets, oversized maps, color photos, you name it in these files, 
and the images will all be faxed out, so I don't want high color or anything 
other than 8.5x11.)

I do this in several passes -- at first, I read the entire image into an 
object, and iterate through each page to cope with each orientation. If that 
fails, then I use convert to write each page out as a bmp, and do the same. If 
it still fails, I then use ghostscript directly to write each page out as a 
bitmap.

Part of the reason this works/fails the way it does is a lack of space in 
/tmp, and there's nothing I can do about that. The second iteration uses a 
little less /tmp space, and the third writes to a filesystem with plenty of 
space -- but this is dog-slow, so it is never my first choice. (some of these 
pdf files are over 1,000 pages, and at 8Mb/page for 300x300, can overrun my 
filesystem -- I can run df repeatedly from another terminal and watch space 
fill up until it hits 100% and then the fun stops). Another reason has to do 
with how different versions of ghostscript handle things. That's not Image 
Magick's problem.

I suggest that rather than go directly to jpeg, you try writing to bitmap and 
convert them to jpeg, but if that fails, try a ghostscript command like:

gs -q -dNOPAUSE -dBATCH -sDEVICE=bmp256 -r200x200 -sOutputFile=foo-%d.bmp 
bar.pdf

and look at the bitmaps to see what you have. 

ymmv.

Vary the device and resolution to suit.

Try the jpeg device if you want, but if you can't get raw bitmaps, then you're 
wasting your time trying to get jpegs.

Also, does anybody know how to point my Image::Magick object to a different 
filesystem for temp file usage? 
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to