PDA

View Full Version : Importing 256 color (paletted) images results in grayscale..



Robert Kosek
20-11-2007, 04:16 PM
It's ugly, but true. To save space I've been using PNG-8 formatted images to save my work. There's no real loss in quality by using it except when importing that information. When I import the image to edit the tiles and frames in it the image is a very ugly grayscale.

Anything you can do to fix that?

jdarling
20-11-2007, 04:36 PM
Use a better image editing package. Personally ArtWeaver does a good job of working with PNG8 files. There are other products out that allow you to easily edit PNG8's as well, ArtWeaver just had the best feature set for the buck (free) when I was looking.

Robert Kosek
20-11-2007, 04:53 PM
You're misunderstanding the problem.

I use Adobe Photoshop 7 and have exported to a perfectly valid PNG-8 file. Firefox, IE, and even Windows' crummy image previewer all show it correctly. But when I import it into Phoenix's image editor to set up my tiles and "slices" of the image for frames the file isn't loaded correctly.

Hence my question to Andreaz possibly fixing the loading problem. His tool ignores the palette and treats the image as a grayscale image, which it most certainly isn't (in this instance).

Andreaz
21-11-2007, 10:10 PM
That is some limitations in the freeimage loader in such cases, i'm just using the raw 32bit texture data it provides. My guess is that it doesnt support palleted png's.

You can write you'r own loader by extending the TPHXTextureManager class if you have code to load PNG-8 with palette functionality.

It doesnt matter if the imageeditor show the images incorrectly if you have working code for loading the images in the game. The image format in phx just appends the original image to the new file and thus there's no format change.

User137
22-11-2007, 12:21 AM
You could try if pngimage could load palette.
http://pngdelphi.sourceforge.net/

Galfar
22-11-2007, 09:44 AM
That is some limitations in the freeimage loader in such cases, i'm just using the raw 32bit texture data it provides. My guess is that it doesnt support palleted png's.

You can write you'r own loader by extending the TPHXTextureManager class if you have code to load PNG-8 with palette functionality.

I've writen TPHXTextureManager that uses Imaging instead of FreeImage a while ago. Supports all PNG formats, maybe you'll find it useful.

http://galfar.vevb.net/temp/phx/phxTexture.pas
(Uses some older Phoenix but I guess TPHXTextureManager haven't changed since then)