Fast conversion of postscript files

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
hoopz

Fast conversion of postscript files

Post by hoopz »

Okay, I have two questions, but I am basically just trying to figure out the fastest way to do this.

I have a program that I call from my web app that takes some user input and produces an image. This program produces images in postscript format, but since I want them to be displayed on the web I use IM to convert them to jpegs. All I am using is the command:

Code: Select all

convert image.ps image.jpg
Now, the images that are produced are essentially black and white graphs, and the above is working fine when the graphs are of reasonable dimensions. However, sometimes there is a lot of data on the graph and I have to create a larger image file. The default size of the jpeg if I don't change anything is 612x792, but I want to be able to make this say, 10 times larger, without losing quality. I feel like this is something I should be able to do since postscript is vector based, right? But I've tried throwing the -resize option into my convert command and it seems like it is converting to jpeg and then resizing, and the quality is bad. Anyone know of a way to do this without losing quality?

Presently, I am using an option in the program to resize the physical paper size of the postscript file. Normally, the paper size is 20x26 cms, which when converted results in the 612x792 jpeg. If I change the size to 200x260 cms, for example, and then convert, I get a much larger image and it looks beautiful. The only problem in this is that the conversion takes quite awhile in this case. So, my second question is, are there ways to speed up conversion or is there another web viewable file format that I can use that might be faster to convert to?

Any advice would be greatly appreciated, whether it is in response to one of my questions or a different approach I might take. Thanks!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Fast conversion of postscript files

Post by anthony »

Add a -density setting before reading the postscript. The default density is 72 dpi whcih is 'screen resolution'. for printer quality try 600dpi

You can also use an even higher resolution, then resize the image, to produce a better anti-aliased result.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
hoopz

Re: Fast conversion of postscript files

Post by hoopz »

Thanks for the tip, but it's not working like I need it to. Here's what I am doing:

Code: Select all

convert image.ps image.jpg
gives me a 612x792 jpeg, but I want something larger but without reduced quality.

So I tried

Code: Select all

convert image.ps -density 600 image.jpg
and it gave me the same as the first.

I tried

Code: Select all

convert image.ps -density 600 -resize 200% image.jpg
and it gave me an image twice the size of the original but with reduced quality.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Fast conversion of postscript files

Post by magick »

Put -density before the Postscript image filename.
Post Reply