[pmwiki-devel] PDF to image recipe in Vol 68, Issue 1

W Randolph Franklin pmwiki at wrfranklin.org
Tue Aug 13 10:46:20 CDT 2013


Re:



This may be more detail than is relevant here, but anyway:

There is a quality problem with converting from PDF or PS to a raster
image format.  PDF and PS often use vectors internally, so the
resolution that the file is rasterized at is important.  However most
conversion programs that I've used, such as ImageMagick 'convert' and
ghostscript have hardwired in a very low resolution, like 60dpi.

My solution, obtained after much experimentation, is this:

    gs -sDEVICE=jpeg -r1000 -dNOPAUSE -sOutputFile=TEMP.jpg FILE.pdf
-c quit
    convert -resize 1000 TEMP.jpg FILE.jpg
    rm TEMP.jpg

This also causes subpixel averaging to be used, which is a big win, and
which was surprisingly difficult to get.

This doesn't answer the question of how you call external programs, and
whether it's prudent to (given the abysmal state of SW security).

Side note: I've been using pmwiki for over a decade, for internal and
external documentation of various project, and now have over 1000 pages.
 It's worked quite nicely.


--
W. Randolph Franklin
pmwiki at wrfranklin.org
http://wrfranklin.org/





More information about the pmwiki-devel mailing list