Hello,
I am converting postscript to png, but I get vertical and horizontal artifacts in the final image. They look like gaps in the solid fill. Even though using -density 600 reduces the effect, it does not remove it. Is there another solution to preserve the quality?
Thanks.
postscript conversion - artifacts
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: postscript conversion - artifacts
Images in postscript are saved at a specific resolution. If IM does not read that postscript file at the same resolution the image will loose quality.
I would love to see a method to extracting an image from postscript directly as a raster image (1:1 pixel mapping), but that seems to be impossible.
I would love to see a method to extracting an image from postscript directly as a raster image (1:1 pixel mapping), but that seems to be impossible.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: postscript conversion - artifacts
Oddly enough -colorspace RGB seemed to help. Where in the postscript image is the dpi stored? This is a ps not an eps.
edit: I am printing from matlab which claims it uses 864 dpi for non image types. Converting at that density causes very small diagonal striations which do not show up that badly when the image is resized. I post my success here for other matlab users to find.
Ultimate, but slow, ps to png for matlab generated ps:
matlab matlab postscript postscript density density dpi dpi
edit: I am printing from matlab which claims it uses 864 dpi for non image types. Converting at that density causes very small diagonal striations which do not show up that badly when the image is resized. I post my success here for other matlab users to find.
Ultimate, but slow, ps to png for matlab generated ps:
Code: Select all
convert -colorspace RGB -density 864 -trim -border 80 -bordercolor white -filter box -support 1.5 -resize 15% -depth 8 -colors 256 test.ps test.png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: postscript conversion - artifacts
EPS and postscript are the same thing. EPS just is a single page with comments defining the drawing bounds. nothing more.
Postscript normally does not have any DPI or resolution in it. It is a vector drawing language, so should be able to draw any ANY scale. Imbeded raster images however have a size in terms of pixels, postscript however prints that image
to a certian size.
What we want to do is match the size the postscript draws at (set by the resolution or density of the drawing process) to the embeded raster image so that one pixel is one dot and drawn. That is the difficulty as it is next to imposible to determine as postscript is also a computer language.
Idealy we should be able to extract the raster image data in the postscript file, as a raster image, and ignore density entirely. However I know of no utility to do this. Ghostscript is in an ideal position to do this, but currently provides no option to do so.
If the postscript is purely vector (no raster images), then there is no fixed resolution, and you can set whatever dpi you thing is appropriate. Imagemagick itself does not mind, as it does not deal with a specific physical output device.
Postscript normally does not have any DPI or resolution in it. It is a vector drawing language, so should be able to draw any ANY scale. Imbeded raster images however have a size in terms of pixels, postscript however prints that image
to a certian size.
What we want to do is match the size the postscript draws at (set by the resolution or density of the drawing process) to the embeded raster image so that one pixel is one dot and drawn. That is the difficulty as it is next to imposible to determine as postscript is also a computer language.
Idealy we should be able to extract the raster image data in the postscript file, as a raster image, and ignore density entirely. However I know of no utility to do this. Ghostscript is in an ideal position to do this, but currently provides no option to do so.
If the postscript is purely vector (no raster images), then there is no fixed resolution, and you can set whatever dpi you thing is appropriate. Imagemagick itself does not mind, as it does not deal with a specific physical output device.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: postscript conversion - artifacts
Okay. I thought that the standard eps not only had a bounding box for the vector data, but also a raster preview of the vector data. I did not realise ps could also have a raster preview.
Funny thing is, my ps is pure vector data, but it does seem to matter to imagemagick what density I specific. A lower density leads to more striation artifacts.
Funny thing is, my ps is pure vector data, but it does seem to matter to imagemagick what density I specific. A lower density leads to more striation artifacts.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: postscript conversion - artifacts
A eps with a preview image is an epsi image
It is optional.
And of course it matters. The density tells the postscript how many dots per inch, and postscript specifies all vector image stuff in points, which are 72 points per inch. that is in real world terms, not in raster image pixel terms.
A different density will equate pixels to inchs and thus points, or other real world measurements to pixels. it makes a difference.
Default denisty in IM is 72. making one point = one pixel.
DPI = dots (pixels) per inch.
It is optional.
And of course it matters. The density tells the postscript how many dots per inch, and postscript specifies all vector image stuff in points, which are 72 points per inch. that is in real world terms, not in raster image pixel terms.
A different density will equate pixels to inchs and thus points, or other real world measurements to pixels. it makes a difference.
Default denisty in IM is 72. making one point = one pixel.
DPI = dots (pixels) per inch.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/