PS to GIF conversion producing poor results

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
naoliv
Posts: 110
Joined: 2007-12-10T18:54:27-07:00
Location: Brazil

PS to GIF conversion producing poor results

Post by naoliv »

Hi!

From http://bugs.debian.org/536892
Using this file and running convert -density 240 -trim input.ps output.gif, we are seeing a poor result if compared with ImageMagick 6.2.4-5
With the older version we have this, while with newer versions we see this.

I can see the same poor result with latest 6.5.4-9
Did something change when encoding a GIF file?

Thank you.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PS to GIF conversion producing poor results

Post by magick »

Try this command:
  • convert -density 240 input.ps -trim -flatten output.gif
If that does not produce similar results, edit delegates.xml and change the pngalpha Ghostscript device to pnmraw and see if that fixes the problem.
naoliv
Posts: 110
Joined: 2007-12-10T18:54:27-07:00
Location: Brazil

Re: PS to GIF conversion producing poor results

Post by naoliv »

With --flatten it did work as expected.
Will this behavior be changed or it will be necessary to always include --flatten, please?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PS to GIF conversion producing poor results

Post by magick »

ImageMagick must choose a Ghostscript device based on the attributes of the Postscript file. If the image is EPS we use the pngalpha device since many EPS images have transparency. If you don't want transparency, use -flatten as recommended which composites the transparent image onto the image background color.
naoliv
Posts: 110
Joined: 2007-12-10T18:54:27-07:00
Location: Brazil

Re: PS to GIF conversion producing poor results

Post by naoliv »

Hi!

From another user:
Please consider that adding -flatten parameter is not a solution for all
purposes, because transparency is often needed in output images.
Heiler81
Posts: 63
Joined: 2009-03-12T01:52:24-07:00
Authentication code: 8675309
Location: Germany, Stuttgart

Re: PS to GIF conversion producing poor results

Post by Heiler81 »

Please consider that adding -flatten parameter is not a solution for all
purposes, because transparency is often needed in output images.
Well gif didn´t support Alpha Channels so if you got some and you want a gif you need flatten etc. Same problem also in other formats (jpeg, .....).

Workaround: First check what you got in picture and than check what the new picture will support.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PS to GIF conversion producing poor results

Post by fmw42 »

inkdroplet wrote:
magick wrote:ImageMagick must choose a Ghostscript device based on the attributes of the Postscript file. If the image is EPS we use the pngalpha device since many EPS images have transparency. If you don't want transparency, use -flatten as recommended which composites the transparent image onto the image background color.
This is my last bumped thread I promise. The search feature has been my best friend today. My question for you Magick, is the flatten command the same thing as rasterizing a layer like in Photoshop? Instead of answering the question because I have a lot of wonder, maybe just a link to the command description or something would be very helpful. Thanks so much, and I apologize for reviving a couple of old topics, but I have been learning a ton.
I hope this is what you are looking for:

see Anthony's Examples
http://www.imagemagick.org/Usage/layers/#flatten

and descriptions of -layers flatten at
http://www.imagemagick.org/script/comma ... php#layers

-flatten is a shortcut for -layers flatten
Jorge
Posts: 3
Joined: 2011-09-01T06:21:19-07:00
Authentication code: 8675308

Re: PS to GIF conversion producing poor results

Post by Jorge »

It took me quite long to go deeply into positioning of layered images, but without the instructions it'd much worse. Thanks, fmw42!
Last edited by Jorge on 2012-06-21T01:02:07-07:00, edited 2 times in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: PS to GIF conversion producing poor results

Post by anthony »

-flatten basically generates a background color image the same size as the virtual canvas of the first image.
It then composites every image onto this background.

If multiple images are not involved then it essentially replaces any transparency with the default background color 'white'.

An alternative if you want to preserve multiple images is to use -boardcolor white -border 0 . This may not seem 'sensible' but it does basically the same thing, compose the image onto a white fully-opaque background to remove all transparency.

The other differences is that -border uses a different color setting, keeps multiple images separate, and it uses the images real dimensions instead of the the virtual canvas and offset.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply