Saving 8bit texture
Hi,
is it possible to save an 8bit texture, thats textures with a 256 colour palette and then an index number for the palette for each pixel.
Is it possible to save one of these textures via the D3DXSaveSurfaceToFile or similar?
Yea with no success, im reading the palette and then reading the indexes and creating a D3DFMT_A8B8G8R8 texture from the colours.
So my goal is to save out the palette and then the indexes.
When i read the texture in should i keep the palette around so it can be used for saving later, or is it possible to gen a new one at save time?
If the texture gets changed in between a new one would have to be generated.
So my goal is to save out the palette and then the indexes.
When i read the texture in should i keep the palette around so it can be used for saving later, or is it possible to gen a new one at save time?
If the texture gets changed in between a new one would have to be generated.
Quote:Original post by REspawnHow so? Crash? Corrupt image? No image? Are any functions failing? Are you linking to d3dx9d.lib instead of d3dx9.lib (Assuming DX9 that is)? Are you using the Debug Runtimes?
Yea with no success
I've never tried to save palettised images before, but I'd imagine you'll need to specify the palette (Or generate it yourself). I doubt the D3DX team would spend time writing code to generate a 8 bit palette from a 32-bit image, considering how little it'd be used.
If you know that the image contains less than 256 unique colours, then generating an 8-bit palette from a X bit image is pretty trivial. If you have more than 256 unique colours, then you need to start doing colour matching and stuff, which I suspect there's a grat deal of material on (I know that Photoshop and Irfanview both have 3 or 4 different methods of generating palettes that you can choose between).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement