Sign in to follow this  

Saving 8bit texture

This topic is 3627 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by REspawn
Yea with no success
How 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?

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).

Share this post


Link to post
Share on other sites
No no, the image saves fine, but i dont get any palette from the save, from searching around I cant seem to find anything about it so im just going to have to gen a palette myself.

Thanks for the replys.

Share this post


Link to post
Share on other sites

This topic is 3627 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this