I'm stuck and can't figure out how to get a transparent PNG to convert to a JPG. When I do a straight convert, I get this strange grey halo around the outer edge of the object in the image.
Ultimately, I'm trying to take my transparent PNG, apply a white background, and convert it to a JPG. I followed this
Any ideas?
Source Original PNG Image: http://www.carametrix.com/ExampleImageSource.png
Resulting Problem JPG Image: http://www.carametrix.com/ExampleImageResult.jpg
PNG Transparency to JPG - Halo Ring Problem
-
- Posts: 2
- Joined: 2012-04-05T23:31:36-07:00
- Authentication code: 8675308
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PNG Transparency to JPG - Halo Ring Problem
try
convert ExampleImageSource.png +repage -background white -flatten ExampleImageSource.jpg
see
http://www.imagemagick.org/Usage/layers/#flatten
The +repage is needed to remove the virtual canvas on your png so that your jpg does not have a lot of extra white space all around it.
convert ExampleImageSource.png +repage -background white -flatten ExampleImageSource.jpg
see
http://www.imagemagick.org/Usage/layers/#flatten
The +repage is needed to remove the virtual canvas on your png so that your jpg does not have a lot of extra white space all around it.
-
- Posts: 2
- Joined: 2012-04-05T23:31:36-07:00
- Authentication code: 8675308
Re: PNG Transparency to JPG - Halo Ring Problem
Wow...that worked! That was incredibly helpful. Thank you for your help.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: PNG Transparency to JPG - Halo Ring Problem
The correct way is to use -alpha remove
See Removing Transparency from Images
http://www.imagemagick.org/Usage/masking/#remove
The flatten method works though uses more memory and processing and can go wrong in specific situations as you are applying a operator that is not actually designed for removing transparency, it is just a side-effect of what its real purpose is.
See Removing Transparency from Images
http://www.imagemagick.org/Usage/masking/#remove
The flatten method works though uses more memory and processing and can go wrong in specific situations as you are applying a operator that is not actually designed for removing transparency, it is just a side-effect of what its real purpose is.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PNG Transparency to JPG - Halo Ring Problem
Perhaps you should mention at what version of IM -alpha remove was added. Is it not relatively recent (6.7.5.x), but what minor version? Changelog says 6.7.5-1anthony wrote:The correct way is to use -alpha remove
P.S. It is not even listed as an option at http://www.imagemagick.org/script/comma ... .php#alpha