Page 1 of 1

[Solved] How do I create an 8-bit grayscale .TGA?

Posted: 2016-10-16T21:16:23-07:00
by shauno
I'm trying to create a texture to use in a game engine. This particular engine needs Targa 8Bpp Grayscale images without an alpha channel. Unfortunately, the program that I use (Paint.NET) will not save .TGAs lower than 24-bit, and it doesn't have an option for grayscale. I've tried to create one with ImageMagick using these parameters:

Code: Select all

convert spec.tga -type Grayscale -depth 8 spec2.tga
This spits out my spec2.tga, but when I try to import it into the game assets, it throws me this error:
Image

However, when I export and import the original texture, it works perfectly. I ran the identify command on both images to see what the difference was, but they seem to be exactly the same. (The original is ThisWorks.tga, mine is spec2.tga)
Image Image

I am using the latest version of ImageMagick (ImageMagick-7.0.3-4-Q16-x64-dll.exe) and I'm running on Windows 10. What am I doing wrong?

Re: How do I create an 8-bit grayscale .TGA?

Posted: 2016-10-16T22:17:19-07:00
by snibgo
I suppose there is some other difference between the files, and the error message you get is a generic "there is a problem" message.

There may be something in a TGA file that IM doesn't report because it isn't relevant to IM. "-strip" might solve that.

I suggest you look further in the "-verbose" outputs, and perhaps also exiftool.

Re: How do I create an 8-bit grayscale .TGA?

Posted: 2016-10-16T22:50:53-07:00
by shauno
I don't think it's just a default "something happened" message because if I save the image as an 8-bit .png and then use IMDisplay to save it as a .tga, it gives me a different message saying "Error: TGA is not greyscale!"
Image

How do I get a better look at the identify outputs? For me it opens a command prompt, prints out all the info and immediately closes. It's only up for half a second and I had to take a screenshot just to read it. Is there any way I can make the window stay open or have it write to a text file?

I'll check out the -strip command and exiftool.

Re: How do I create an 8-bit grayscale .TGA?

Posted: 2016-10-16T23:05:22-07:00
by snibgo
shauno wrote:Is there any way I can make the window stay open or have it write to a text file?
Yes, you can write it to a file. I don't know how you are running commands such that the window immediately closes. I suggest you open a command window, and type commands in it. Then the window will stay open until you tyoe "exit".

Almost all IM tools are designed to be run from the command prompt, in a command prompt window.

Re: How do I create an 8-bit grayscale .TGA?

Posted: 2016-10-16T23:36:22-07:00
by shauno
This is what happens when I run IM with identify: https://youtu.be/tiDXyJkiNBY

How do I have it write to a file? I tried -debug -log but it didn't do anything. Or maybe it did write to a log and I just can't find it? Help me out here.

Re: How do I create an 8-bit grayscale .TGA?

Posted: 2016-10-17T00:12:35-07:00
by shauno
Derp. It was doing that because I was using the start command which opens the command prompt in a new window. :?

So I found out the original image has only three RGB values while mine has a fourth one.
Image Image

I suppose that's for alpha? I supposed that's what was causing the problem, so instead of Grayscale I used GrayscaleMatte to remove the alpha channel and it worked! Wonderful! Thanks for your help.