Page 1 of 1

Convertion png to jpg leads to negative

Posted: 2011-12-11T08:54:49-07:00
by Hubbitus

Re: Convertion png to озп leads to negative

Posted: 2011-12-11T11:56:08-07:00
by fmw42
Perhaps due to a cmyk jpg or something odd about your png.

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?

Re: Convertion png to jpg leads to negative

Posted: 2011-12-11T15:05:36-07:00
by Hubbitus
Could you please test it on images attached to mentioned bug too?

Re: Convertion png to jpg leads to negative

Posted: 2011-12-11T15:13:04-07:00
by glennrp
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

Code: Select all

convert -size 567x794 xc:white a.PNG -flatten white.jpg
(what they expected) with

Code: Select all

convert -size 567x794 xc:black a.PNG -flatten black.jpg
(what they see)

Re: Convertion png to jpg leads to negative

Posted: 2011-12-12T08:53:20-07:00
by Hubbitus
Thanks for the investigation in any case.

Re: Convertion png to jpg leads to negative

Posted: 2011-12-12T10:46:06-07:00
by fmw42
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

Re: Convertion png to jpg leads to negative

Posted: 2011-12-14T23:21:59-07:00
by anthony