recomendations to improve speed?
recomendations to improve speed?
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.
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?
Try the following command:
- convert -limit area 4096 -limit memory 4096 -density 200 -monochrome +antialias image.ps -compress Group4 image.tiff
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: recomendations to improve speed?
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: recomendations to improve speed?
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?
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?
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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: recomendations to improve speed?
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...
You can get ghostscript to do it directly.
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.
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
Code: Select all
gs -sDEVICE=tiffg4 -r300x300 -dNOPAUSE -sOutputFile=file.tif \
file.pdf
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: recomendations to improve speed?
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!
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?
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
/usr/bin/gs -dBATCH -dNOPAUSE -sDEVICE=tiffg4 -r200x200 -sOutputFile=file.tiff file.ps
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: recomendations to improve speed?
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.
I have updated the example, give it a day or so to appear on the IM main site.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: recomendations to improve speed?
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: recomendations to improve speed?
It would probably improve the speed to DIY.
however ghostscript is not easy to use. here is what cristy has said in the past...
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/