Page 1 of 1
recomendations to improve speed?
Posted: 2007-02-26T16:58:36-07:00
by rgwillia
I am trying to automate a process that takes a print job in PostScript format and converts it to a tiff image. The standard "convert image.ps image.tiff" is not nearly high enough quality to read. The files are scanned in B&W documents (no greyscale needed) that were sent via a print job to a server that saved them in PS format. I found that I needed to increase the density to around 200 to be able to read the documents. Each document is between 10 and 20 pages. The desired file size is less than 1mb. (we have other applications that use similar files that are easily able to accomplish this with tiff images)
I am new at this but here is my command so far.
convert -density 200 image.ps -colorspace GRAY -monochrome -compress Group4 image.tiff
The PostScript file is about 9mb and the output file is about 0.5mb. Each file is taking about 6min to process and I will have upwards of 300 of these to process each day. Unless I find a way to get myself 30 hours in a day I need to do someting to speed this process up.
The machine running the conversion is a fairly high speed machine and the OS is hosted in a VMWare ESX virtual machine Running Suse 10.2 using ImageMagick 6.3.0.
Re: recomendations to improve speed?
Posted: 2007-02-26T19:00:28-07:00
by magick
Try the following command:
- convert -limit area 4096 -limit memory 4096 -density 200 -monochrome +antialias image.ps -compress Group4 image.tiff
You might get some additional speed improvements with the latest ImageMagick release, 6.3.2-9.
Re: recomendations to improve speed?
Posted: 2007-02-26T19:16:32-07:00
by anthony
As for quality improvements all you can do is use an even higher density, however that will make it at least a square slower (double density is 4 times the memory requirements) for both IM and the ghostscript delegate.
Re: recomendations to improve speed?
Posted: 2007-02-27T09:14:27-07:00
by rgwillia
anthony wrote:
As for quality improvements all you can do is use an even higher density, however that will make it at least a square slower (double density is 4 times the memory requirements) for both IM and the ghostscript delegate.
I do not need much more in the way of quality improvements. I mainly need speed improvements. I tested an application on a windows box that only took seconds to do almost the exact same thing. (except that it broke it into individual 1 page tiff files).
Re: recomendations to improve speed?
Posted: 2007-02-27T10:14:50-07:00
by magick
Try using Ghostscript directly to convert your image and bypass ImageMagick. Ghostscript has a TIFF device you can use to convert Postscript to TIFF.
Re: recomendations to improve speed?
Posted: 2007-03-01T12:44:08-07:00
by rgwillia
Try using Ghostscript directly to convert your image and bypass ImageMagick.
Can you point me in the right direction here? I don't see any actual CLI applications as part of ghostscript, just a library.
Re: recomendations to improve speed?
Posted: 2007-03-01T18:44:41-07:00
by anthony
See the adendium in IM Examples Text to Image handling, Postscript
http://www.imagemagick.org/Usage/text/#postscript
At the very end of that section just before 'Draw'.
---------------
ASIDE: Using Ghostscript directly...
While this not strictly IM, Richard Bollinger have reported that running the "ghostscript" delegate directly is much more efficient.
For example instead of running...
Code: Select all
convert -density 300x300 -compress Group4 file.ps file.tif
You can get ghostscript to do it directly.
Code: Select all
gs -sDEVICE=tiffg4 -r300x300 -dNOPAUSE -sOutputFile=file.tif \
file.pdf
This prevents the need for IM to generate a large temprorary file, and quite a lot of extra time.
However "ghostscript" can not resize the resulting image, and may not have the image format you specifically require. It can also be a difficult program to figure out how to use, as it is designed to be used by other programs and not directly by users.
Re: recomendations to improve speed?
Posted: 2007-03-05T09:23:39-07:00
by rgwillia
Wow,
That was MUCH faster. It only takes about 3/4 of a second instead of 3mins using imagemagick. It also appears to be about the same quality and size. The only thing I need to figure out now is why it is dropping me into a "GS>" prompt instead of back to command line. Off to read the man page!
Re: recomendations to improve speed?
Posted: 2007-03-05T09:48:42-07:00
by rgwillia
I am just posting to reply to my own message here incase anyone needs the answer in the future. If you don't want the GS> prompt you must use the option -dBATCH. The full command that I used was:
/usr/bin/gs -dBATCH -dNOPAUSE -sDEVICE=tiffg4 -r200x200 -sOutputFile=file.tiff file.ps
Re: recomendations to improve speed?
Posted: 2007-03-05T20:06:56-07:00
by anthony
I applogies by the HTML did not show the "</dev/null" that was on the end of the 'gs' example. however the -dBATCH is probably a better method.
I have updated the example, give it a day or so to appear on the IM main site.
Re: recomendations to improve speed?
Posted: 2007-03-06T14:06:39-07:00
by RXGX
Would it be faster if I had GS perform the PDF to TIF conversion in the following code?
Code: Select all
convert -density 300 -units PixelsPerInch -profile cmyk.icc -profile srgb.icm {$name}.pdf -resample 72x72 {$name}.tif
convert {$name}.tif -quality 100 -resize 244x {$name}-thumb.jpg
convert {$name}.tif -quality 100 {$name}-large.jpg
Re: recomendations to improve speed?
Posted: 2007-03-06T22:52:59-07:00
by anthony
It would probably improve the speed to DIY.
however ghostscript is not easy to use. here is what cristy has said in the past...
If ghostscript had one robust device to handle RGB, RGBA, CMYK, and CMYKA image types (RGB and CMYK with and without transparency) ImageMagick would be able to render Postscript to an image format quite robustly. However, ImageMagick has to select from different devices based on what it sees in the Postscript document. It chooses the device conservatively to ensure the conversion is proper for a great majority of Postscript documents.