driver needed to print to .jpg file

Kurt Pfeifle kurt.pfeifle at infotec.com
Tue Jun 24 02:16:08 PDT 2008


> We want to setup a printer queue where the output are files in jpeg format.
> I have looked all over the place but I can't find the necessary driver.
>
> Can somebody please point me to where I can get such a jpg printer driver?

Ghostscript can be made to that "driver" for you. Your CUPS filter or backend that is supposed to create your JPEGs (that filter/backend can even be a shell script) just needs to call Ghostscript with a commandline similar to the following:

gs -dQUIET \
   -dBATCH \
   -dNOPAUSE \
   -sDEVICE=jpeg \
   -r600x600 \
   -sPaperSize=a4 \
   -sOutputFile=/target/directory/p%08d.jpeg \
   $input

Your $input may be PostScript or PDF. It can come from a file or from <stdin> (careful: if PDF, only recent Ghostscript versions can use <stdin>).

The "-sDEVICE"-parameter tells Ghostscript to output JPEG.

The "-r600x600" one sets a resolution. You may change that.

The "-sPaperSize" argument sets an output format. There are many other. alternative options for this available (like arbitrary ones, like "-g4960x7040" to set the size in pixels). For details look for the "Use.htm"-page in your Ghostscript documentation.

The "p%08d"-syntax tells Ghostscript to create a new image file for each page, and to fill the leading digits with '0's: p00000001.jpeg, p00000002.jpeg, etc.

It is up to your own creativity and imagination to determine the /target/directory/ path to make sure that consecutive jobs don't overwrite previous ones. See the CUPS manpages for "filter" and "backend".




More information about the cups mailing list