X16PngConverter - now for Windows, Linux and macOS

HunterDX
Posts: 3
Joined: Wed Aug 07, 2024 11:24 pm

Re: X16PngConverter - now for Windows, Linux and macOS

Post by HunterDX »

Thank you for building this tool! :D

Please correct me if I have this wrong, but it seems I have a use-case that is unachievable. For example: If I have VERA Layer 0 set to 16x16 tiles @2BPP, the expected data size for a single tile is 64 bytes. I have tiles with 2 colors, but the tool doesn’t account for my chosen 2BPP depth, and will only output my tiles at 1BPP @ 32 bytes each. It seems the tool would need to support another input field for BPP so it outputs the expected BIN data?
Johan Kårlin
Posts: 292
Joined: Wed Jun 03, 2020 11:33 am
Location: Kalmar, Sweden

Re: X16PngConverter - now for Windows, Linux and macOS

Post by Johan Kårlin »

HunterDX wrote: Fri Aug 09, 2024 3:10 am Please correct me if I have this wrong, but it seems I have a use-case that is unachievable. For example: If I have VERA Layer 0 set to 16x16 tiles @2BPP, the expected data size for a single tile is 64 bytes. I have tiles with 2 colors, but the tool doesn’t account for my chosen 2BPP depth, and will only output my tiles at 1BPP @ 32 bytes each. It seems the tool would need to support another input field for BPP so it outputs the expected BIN data?
Sorry for my late response! You are right, my thought has been that the application can select BPP based on the number of colors in the original image. I suppose you wish to have 2 bpp to keep both colors and avoid one being transparent. In a way, that means that your image has three colors. For now, the easiest way to achieve what you want is adding a color that is not used:

If the original is a full-color image (no palette) (This is probably the case):
Give the top left pixel in the image a third color. In the conversion, the color of this pixel will get index 0 (transparent), the other two colors will have index 1 and 2 and the result will be 2 bpp.

The downside of this is of course that your first tile will be useless, but maybe that is not a big problem? You can choose to give some other pixel a third color but then you must use the -t option to specify that it is this color that should get index 0 (= be transparent).

If the original is indexed (has a palette):
Use a palette with 3 colors, the colors you already have plus one random.

I will see if I will make any changes to the tool, Probably, this won't be a common scenario, and making a change raises new questions about the palette in the converted image.
HunterDX
Posts: 3
Joined: Wed Aug 07, 2024 11:24 pm

Re: X16PngConverter - now for Windows, Linux and macOS

Post by HunterDX »

I ended up trying your second suggestion. I saved a PNG indexed with 4 colors and got what I wanted. Thanks!
Post Reply