I wanted to view a PDF on my PSP, but unfortunately the PDF was full of images so the usual viewer bookr didn’t want to load it. Luckily I managed to figure out how to convert the PDF into JPEGs so I could view them. Since I hadn’t found a guide in my searches, here is a rough guide of how I did it.
The Tool of choice for this exercise is ghostscript, in particular the command line component ‘gs’. Ghostscript is a PDF/PS interpreter, available on linux and windows (SF.net Download). The magical command line I used was:
gs -sDEVICE=jpeg -dJPEGQ=95 -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dDOINTERPOLATE -sOutputFile=m_%d.jpg -dSAFER -dBATCH -dNOPAUSE -r57x58 M.pdf
What does this all do?
- sDEVICE=jpeg -dJPEGQ=95
- Defines the image output format, there are alot of image types that can be saved, I chose JPEG as the PSP cannot view PNG images in the built in image viewer.
- The list of available outputs can be found by running gs with no command line arguments, or by visiting http://www.cs.wisc.edu/~ghost/doc/cvs/Devices.htm
- -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dDOINTERPOLATE
- Antialiasing settings, these make your output look the best. Use them.
- The output file name, %d implies you want to split images by page, the %d will be replaced with the page number.
- -dSAFER -dBATCH -dNOPAUSE
- Batch processing options, makes gs output all of the images without stopping and confirming.
- Resolution of output images, I had to play with this a bit to get the exact numbers, depends on your input file too.
- The name of the input file.
Anyway, so you run that and suprise suprise you get alot of images, ripe for viewing 🙂 Enjoy.