Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmxrasterizer: option to keep color type and/or palette of PNGs #4007

Open
basxto opened this issue Jul 11, 2024 · 0 comments
Open

tmxrasterizer: option to keep color type and/or palette of PNGs #4007

basxto opened this issue Jul 11, 2024 · 0 comments
Labels
feature It's a feature, not a bug.

Comments

@basxto
Copy link

basxto commented Jul 11, 2024

Is your feature request related to a problem? Please describe.
I use indexed PNGs (color type 3), which is handy for pixel art. Tiled always converts them to true color PNG, which is bigger. Tiled uses RGBA, which is 32bit per pixel, whereas 256 color indexed PNG only has 8bit per pixel. (bpp prior to compression)

There are indeed some difficulties. The tilesets could have different palettes, though it’s straight forward if all tilesets use the same palette. If they are different they could be merged or conversion be refused. Merging would lead to lower file sizes, but it would have no benefit for the following use cases.

I have multiple palettes, which I use with my tilesets. If tiled kept the color type and palette intact, I could open the exported map and switch palettes. Gimp, Grafx2 and mtPaint allow to load different palettes. This again allows to test a map with multiple palettes quickly instead of loading palette, saving the image, switching to tiled, loading the next palette etc.

Furthermore these exports would become usable on retro gaming platforms that use indexed images. (ZX Spectrum, NES, Game Boy etc.) For these platforms it’s important that the indexes are correct since image and palette get loaded separately. Furthermore there are tools who can create tile maps from a tileset PNG and tile map PNG. The twist with this is that they can optimize for hardware capabilities like Y-flip, X-flip etc, which might not be reflected in the tiled map if the map is for multiple platforms.

Another use case is to possibly create an animated GIF where frames share a palette instead of using per frame palettes. APNG always shares the palette between all frames if it’s indexed.

Describe the solution you'd like
Flags like --nc and --np to not meddle with color type and/or palette when exporting to PNG. Could be different flags, that’s just how it’s named in oxipng and optipng.

Describe alternatives you've considered
Writing my own tmx parser/exporter.

@basxto basxto added the feature It's a feature, not a bug. label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

1 participant