Optiroc / SuperFamiconv

Flexible and composable tile graphics converter supporting Super Nintendo, Game Boy, Game Boy Color, Game Boy Advance, Mega Drive, PC Engine and WonderSwan formats.
MIT License
152 stars 22 forks source link

Colours Don't Fit in Palette error when converting image to 2BPP tilemap. #26

Open nikku4211 opened 3 years ago

nikku4211 commented 3 years ago

This is the image used: bg0

In the makefile, these arguments were used:

$(SUFACONV) palette -i $< -d bg0.pal -C 4 -v
$(SUFACONV) tiles -i $< -p bg0.pal -d bg0.pic -B 2 -v
$(SUFACONV) map -i $< -p bg0.pal -t bg0.pic -d bg0.map -B 2 -v

This is the error log I got:

superfamiconv -i bg0.png -p bg0.pal -t bg0.pic -m bg0.map -B 2 -v
Loaded image from "bg0.png" (60x160, indexed color)
Mapping optimized palette (8x4 entries for 8x8 tiles)
Setting color zero to #ffffffff
Generated palette with [4,4,4,4,4,4] colors, 24 total
Created optimized tileset with 118 tiles (discarded 42 redudant tiles)
Mapping 160 8x8 image slices
Error: Colors don't fit in palette
make: *** [Makefile:19: bg0.pic] Error 1

I have tried converting the palette, tileset, and tilemap separately, and it seems the problem starts to happen during the tilemap conversion.

This is the log I got for that:

superfamiconv map -i bg0.png -p bg0.pal -t bg0.pic -d bg0.map -B 2 -v
Loaded image from "bg0.png" (60x160, indexed color)
Loaded palette from "bg0.pal" ([4,4,4,4,4,4] colors, 24 total)
Loaded tiles from "bg0.pic" (118 tiles)
Mapping 160 8x8 image slices
Error: Colors don't fit in palette
make: *** [Makefile:22: bg0.pic] Error 1

So the palette was successfully generated, the tiles were successfully generated, but for some reason, the map wasn't? I literally explicitly set the -B BPP command to '2'.

basxto commented 3 years ago

that is barely readable, you might wanna use code fencing: ``` code ```

nikku4211 commented 3 years ago

that is barely readable, you might wanna use code fencing:

code

Thanks lol

gizaha commented 3 years ago

Same problem. I have a picture that each 8x8 tile has 3 colors, but there are 24 colors in total. Superfamiconv throws "colors don't fit in palette" error if total colors >4.

Rangi42 commented 3 years ago

Your image is not an even number of tiles wide. Pad its right side so it's 64px (8 tiles) wide and it will work.

image