Convertion png to jpg leads to negative
-
- Posts: 66
- Joined: 2010-05-04T10:50:21-07:00
- Authentication code: 8675308
- Location: Russia, Saint-Petersburg
Convertion png to jpg leads to negative
Please look at https://bugzilla.redhat.com/show_bug.cgi?id=757356
Last edited by Hubbitus on 2011-12-11T15:06:14-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convertion png to озп leads to negative
Perhaps due to a cmyk jpg or something odd about your png.Hubbitus wrote:Please look at https://bugzilla.redhat.com/show_bug.cgi?id=757356
Nevertheless, I cannot reproduce it on IM 6.7.4.0 Q16 Mac OSX Snow Leopard.
convert rose: rose.png
convert rose.png rose.jpg
rose.png and rose.jpg look the same (no negation).
What do you get for the above test?
-
- Posts: 66
- Joined: 2010-05-04T10:50:21-07:00
- Authentication code: 8675308
- Location: Russia, Saint-Petersburg
Re: Convertion png to jpg leads to negative
Could you please test it on images attached to mentioned bug too?
Re: Convertion png to jpg leads to negative
I think it's correct, but isn't what they were expecting.
The image (a.png a.k.a. q.png in the bug report) is grayscale, mostly transparent with black
antialiased lines. The JPEG encoder composes it over black (not negative).
Compare (what they expected) with
(what they see)
The image (a.png a.k.a. q.png in the bug report) is grayscale, mostly transparent with black
antialiased lines. The JPEG encoder composes it over black (not negative).
Compare
Code: Select all
convert -size 567x794 xc:white a.PNG -flatten white.jpg
Code: Select all
convert -size 567x794 xc:black a.PNG -flatten black.jpg
-
- Posts: 66
- Joined: 2010-05-04T10:50:21-07:00
- Authentication code: 8675308
- Location: Russia, Saint-Petersburg
Re: Convertion png to jpg leads to negative
Thanks for the investigation in any case.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convertion png to jpg leads to negative
Your image has an alpha channel. The alpha channel is essentially the negative of what you want. The underlying image is mostly fuzzy white outline. As jpg does not support transparency, all transparent areas turn black. So you need to flatten your image against the same color background that you normally present the image against. Lets say white. Then this will convert it properly (as Glenn pointed out)
convert a.png -background white -flatten a.jpg
convert a.png -background white -flatten a.jpg
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Convertion png to jpg leads to negative
See "Removing Transparency"
http://www.imagemagick.org/Usage/masking/#remove
http://www.imagemagick.org/Usage/masking/#remove
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/