Page 1 of 1

Incorrect conversion of PNG file

Posted: 2014-08-05T04:53:55-07:00
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

Re: Incorrect conversion of PNG file

Posted: 2014-08-05T04:58:15-07:00
by magick
convert -size 3004x2254 xc:white GALAXY_S_III_4G.png -composite t.jpg

Re: Incorrect conversion of PNG file

Posted: 2014-08-05T06:43:57-07:00
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!

Re: Incorrect conversion of PNG file

Posted: 2014-08-05T09:36:40-07:00
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

Re: Incorrect conversion of PNG file

Posted: 2014-08-06T02:27:08-07:00
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