PNG image with different palettes
Blitz3D Forums/Blitz3D Programming/PNG image with different palettes
| ||
I need to load the same PNG image but each time using a different color palette. I'm using Blitz2D. Any idea? Ciao, Massimo |
| ||
I don't know what you mean - blitz doesn't support palette graphics modes. |
| ||
You can only use indexed colours in 8-bit graphics modes, which Blitz does not support. |
| ||
Perhaps loading the image, locking the image buffer and using Read/Write pixel fast??? (um.. does Blitz2D have those commands?) |
| ||
The image is stored as png and has a 256 colors palette. I need to change some of the colors. At present I load the image, then I use Read/Write pixel fast (yes, Blitz2d has these commands) The image is big, then it's quite a slow way... ... Using an image editor, it's easy to change a color in the whole image since they're mapped in the palette. You don't need to change every single pixel, but you can simply change that color in the palette. ... Well, the image saved in png format should have some kind of palette containing the colors. I wonder if I can load the image using a different (e.g. external) palette. Or change the palette in the file (without loading the image in memory). |
| ||
Dunno about that. Try www.wotsit.org |
| ||
You *could* read up on the png format and create modified versions of the original file? |
| ||
I will try this way... Thanks to everybody! Ciao. |
| ||
It works! In paletted png images there's a palette chunk, ending with a crc. I do this: 1) load the file .png 2) find the palette chunk 3) change the color in the palette 3) find the new crc of the chunk & overwrite the old one 4) save the new file It's very fast, if someone is interested I posted a sample code: http://blitzbasic.com/codearcs/codearcs.php?code=1326 |