Page 1 of 1

Transparent png -> jpeg artifacts

Posted: 2012-03-29T05:45:23-07:00
by markabey
When converting this image : http://img41.imageshack.us/img41/6104/alienne.png

using "convert alienne.png out.jpg"

I get some funky artifacts - example image here: http://img198.imageshack.us/img198/5652/outte.jpg

using Ubuntu 10.04
Version: ImageMagick 6.6.2-6 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP

Also on CentOS 5.6
Version: ImageMagick 6.7.4-8 2012-01-25 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

Re: Transparent png -> jpeg artifacts

Posted: 2012-03-29T06:38:20-07:00
by magick
Not a bug. Try
  • convert alienne.png -flatten out.jpg

Re: Transparent png -> jpeg artifacts

Posted: 2012-03-30T00:43:17-07:00
by anthony
Actually -flatten is the old method... But the requesters version is too old for the newer method :-(

The newer offical method is to use -alpha remove for the correct method. Added IM v6.7.5

See IM examples, Masking and Background Removal, Removing Transparency
http://www.imagemagick.org/Usage/masking/#remove


That is probably one of the most particular looking 'hidden transparency colors' I have seen!
In fact it was probbaly making the PNG much larger that it has any need to be!

You can make your PNG much smaller in size by replacing the areas of hidden color with a solid color. You can do this using -alpha background. This will not change the look of the PNG image, just make the transparent areas of the image compress better.

See Im Examples, Masking and Background Removal, Alpha Background
http://www.imagemagick.org/Usage/maskin ... background

NOTE this does NOT correctly remove transpareny if you save the result to JPEG. Just clean up that hidden 'noise' in the image, to make it compress better.