megamarc / Tilengine

Free 2D graphics engine with raster effects for retro/classic style game development
https://www.tilengine.org
Mozilla Public License 2.0
847 stars 95 forks source link

PNG requires redundant colours #58

Closed danielgholmes closed 4 years ago

danielgholmes commented 4 years ago

We have a number of sprites that only have 8 colours, When trying to load the images I get an error 'Resource file has invalid format'. We realised that if we add up to 32 redundant colours, it works. We are using Fireworks CS5 and it is a challenge having to always add redundant colours for every new image. Is there something we are missing here? Any suggestions on how we can work around this issue?

Here are two examples:

shot_red_(32colors) 32 colour palette image (working)

shot_red_(8colors) 8 colour palette image (causes error)

ghost commented 4 years ago

It is expected. Tilengine requires an 8-bit palette

32-colour.png: PNG image data, 136 x 17, 8-bit colormap, non-interlaced
8-colour.png:  PNG image data, 136 x 17, 4-bit colormap, non-interlaced
megamarc commented 4 years ago

@daltomi is right: Tilengine loads 8-bpp indexed png's, no automatic color conversion is performed. This is not a bug.