how to use:
using your own pallet with a 1x16px image ./4BS yoursprite.png 1x16pallet.png
or if you want to use pico8 colors ./4BS yoursprite.png
examples of pallet files
still a work in progress it will just give you an output.4BS file
few bugs to mention, sprite width has to be even or else there is miss alignment, dont have an easy fix for it just add a pixel and id sude work
the other thing is const char sprite[] also not sure what im doing wrong in the simulator but this has to be const uint8_t sprite[] i will try and patch that in on a new release soon, will also open up the code wen i clean it up
i will release the source code today, but i have a logic problem i cant seem to figure out
so to generate a pallet from an image i need to parse the hole image and get 16 colors
i got the theory but the code just spits out the same value to all 16
char dex = 1;
pallet[0] = img[0];
for(int i = 0; i <w*h; i++){
short color565 = img[i];
for(int j = 0;j < dex; j++){
if(pallet[j] == color565){
break;
}
// sommething something add to dex add to pallet
}
}
I don’t know how much help this will be. A few years ago I played around with image colour reduction. http://socoder.net/index.php?topic=1636
Basically I recorded every single Colour, sorted them then simply chose every x colour number for the palette. Not perfect by any means, but it did a really good job for 256 colours. Not sure about 16 colours.