Page 1 of 1

Pixels are messed up when converting PNG to JPG

Posted: 2017-01-02T20:04:29-07:00
by dunghnguyen
Hi ImageMagick,

I had a file whose pixels were messed up when converting PNG to JPG.
I tried with the latest version, but there's same issue.
Please help me investigate it.

Sample: https://www.dropbox.com/s/8pta1bcl9vts6 ... s.zip?dl=0

Thanks,
Dung H. Nguyen

Re: Pixels are messed up when converting PNG to JPG

Posted: 2017-01-02T20:18:03-07:00
by GeeMack
dunghnguyen wrote:I had a file whose pixels were messed up when converting PNG to JPG.
I tried with the latest version, but there's same issue.
Please help me investigate it.

Sample: https://www.dropbox.com/s/8pta1bcl9vts6 ... s.zip?dl=0
Please always provide the version of ImageMagick you're using and let us know which platform or OS you're running it on.

At the most basic, your sample looks like you just need to flatten the image onto the background during the conversion. Try this...

Code: Select all

convert sample_input.png -flatten sample_flattened.jpg
Or to select a particular background color other than white in this case, you can try something like this...

Code: Select all

convert sample_input.png -background purple -flatten sample_purple_background.jpg

Re: Pixels are messed up when converting PNG to JPG

Posted: 2017-01-04T01:54:59-07:00
by dunghnguyen
Hi,

Thanks for quick response.

I tested with both version 7.0.1 and 7.0.4 on Windows 8.1 x64

I've just checked "-flatten", it's OK with this sample. However, I need to test more image files before confirming that there's no other issues.

Thanks,
Dung H. Nguyen