Problem with tga to png

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
wahweep

Problem with tga to png

Post by wahweep »

Hi,
I have a bunch of tga files that I am trying to convert to png. Some of these tga files have alpha channels and others do not. Imagemagick seems to do a really nice job with this conversion except for one issue we have stumbled upon in the color down-sampling (-colors flag). Whenever there is an alpha channel in the tga with a lot of grays that are similar to each other, imagemagick seems to have a problem and writes black pixels to the color channel of the image. The black pixels appear to fill the gray value that is most predominant in the scene, but I can't confirm that.

Photoshop:
-New image (RGB, 8-bit, 64x64)
-Fill the rgb color channel whatever color you want.
-Create an Alpha channel.
-Fill the alpha channel with a 145,145,145 gray. (Pretty much any solid color of gray will cause this. Solid black and solid white appear to give correct results)
-Save the image as a 32-bit tga (targa) file.
-I am running the following command:
convert -verbose c:\temp\png_process\Untitled-1.tga -colors 256 c:\temp\png_process\Untitled-1.png
OR
convert -verbose -colors 256 c:\temp\png_process\Untitled-1.tga c:\temp\png_process\Untitled-1.png
When I open the png in an image editor (fireworks, paint.net, photoshop) the color channel is a solid black.

Am I missing something or is this a bug?

Version Information:
Version: ImageMagick 6.3.2 02/05/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

Oh, I forgot to mention I am running WinXP SP2 32-bit, ImageMagick-6.3.2-3-Q16-windows-dll.exe installer, AMD Athlon 3000, 1gig RAM.

Thanks!
Post Reply