Incorrect conversion of PNG file

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Ruvan
Posts: 9
Joined: 2010-03-30T00:28:07-07:00
Authentication code: 8675308

Incorrect conversion of PNG file

Post by Ruvan »

Hi all.
ImageMagick version: ImageMagick 6.8.9-6 Q16 x64 2014-07-22
Windows 7 64bit.

Converting parameters used:
convert "GALAXY S III 4G.png" t.jpg

I don't know where the PNG originates from (yet), but all other major viewers (Photoshop/IExplore/Firefox/Picasa) can view the file properly.

File is here: http://www.fernando.dk/GALAXY_S_III_4G.png

Thanks in advance for investigating.
Best regards,
Ruvan
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Incorrect conversion of PNG file

Post by magick »

convert -size 3004x2254 xc:white GALAXY_S_III_4G.png -composite t.jpg
Ruvan
Posts: 9
Joined: 2010-03-30T00:28:07-07:00
Authentication code: 8675308

Re: Incorrect conversion of PNG file

Post by Ruvan »

Yes that indeed works!

Follow up: My full conversion args include forcing of RGB output, and that does not seem to go well.

My conversion args are currently:

convert.exe -alpha off -strip -colorspace sRGB -resize 1024x1024 -quality 90 xc:white "GALAXY S III 4G.png" t.jpg

Even though it is not working for me, I'm suspecting its because I'm using incorrect parameters.

Thanks in advance!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Incorrect conversion of PNG file

Post by fmw42 »

You should put most if not all the arguments after the image. Also you have not specified a size for the white image. I am not sure why you want to turn off the alpha channel. If you do that, it will completely hided the white image. IM sees an sRGB grayscale image and makes its type grayscale. You cannot change that. But other tools will see it as sRGB. So the -colorspace sRGB is superfluous.

Code: Select all

convert.exe  -size 3004x2254 xc:white ( "GALAXY S III 4G.png" -strip -colorspace sRGB ) -resize 1024x1024 -quality 90t.jpg
But the above will lose the white text.

if you are trying to make the text white on a black background, then do

Code: Select all

convert.exe -size 3004x2254 xc:white ( GALAXY_S_III_4G.png -strip -alpha extract ) -composite -resize 1024x1024 -quality 90 t2.jpg
or if text black on a white background, then do

Code: Select all

convert.exe -size 3004x2254 xc:white ( GALAXY_S_III_4G.png -strip -alpha extract -negate ) -composite -resize 1024x1024 -quality 90 t2.jpg
Ruvan
Posts: 9
Joined: 2010-03-30T00:28:07-07:00
Authentication code: 8675308

Re: Incorrect conversion of PNG file

Post by Ruvan »

Very helpful. Thanks!

The to-RGB conversion is important as the preview image won't display correctly in most browsers otherwise.

Final what works for me is this:
[srcfile] -strip -flatten -colorspace sRGB -resize 250x250 -quality 90 [out]

Thanks again,
Ruvan
Post Reply