Wow. The 4-bit output from GIMP turned out to be tricky to get working.
But now it is working. In native linux.
Just a bit of cleaning up to do & make sure that all sorts of combinations from 1-, 4-, 8- bit input to 1,4,8, output work.
Wow. The 4-bit output from GIMP turned out to be tricky to get working.
But now it is working. In native linux.
Just a bit of cleaning up to do & make sure that all sorts of combinations from 1-, 4-, 8- bit input to 1,4,8, output work.
to make a .c file with 16 color palette (for 110x88 fast 4 -bit mode):
bmp2pok source.bmp -4
to make a .c file with 4 color palette (for 220x176 hires 2- bitmode):
bmp2pok source.bmp -2
attention
switch -p is not needed / working, palette is always created
1-bit files (monochrome bitmaps) are not yet supported, but will come soon
Sorry to report again there are some issue
I think from the Repo thereās a bug on line 24 on common.cpp that prevent compiling.
Even fixing it, I canāt export bmp from gimp to c file. The file is the same Iāve already posted before.
Ok. I will check. I was last working on the win version, maybe I broke something
So I couldnāt resist to write my own exporter
It take any picture (png,gif,bmp,jpg,tiff) and extract a palette of color used. Then build the c file.
It now works with 2bit (4 color) but I could expand to others format.
It was instructive to understand the pokitto image format, but is there any doc about?
I will write a wiki about the format. Canāt wait to try your converter. For some reason it is stuck at āUploadingā¦ā ?
Here some screenshots
Itās just a WIP and error handling is missing, so Iāll need some time to finish it.
Hahaha! i love it! Love the wonky image as well.
Looks good. BTW the reason why the ccc4colors didnt work is because it is 1 bit. But in any case I fixed the errors and updated the github.
Now it can extract an index palette (based on frequency of colors used), still very raw. Output correctly for 2-4 bit mode. 1 bit to test.
Exe can be downloaded here https://www.dropbox.com/s/jld77sntpkfj2gn/img2pok.exe?dl=0
is Net 4.5.2 in Win10 you need anything else. Use small images, as the process is not optimized yet.
Will push a repo if anyone need.
I like your app but would it be possible to read the palette from the bmp file and use that, rather than the order the colours are found in the image?
I;m trying to convert a 12x216 image, but itās coming out wonky. I know .bmp files require padding to multiples of 8, could this be causing an issue with the conversion?
I have completely refactored BMP2POK. I will make it into a batch-processing command line tool for converting a big bunch of files at once.
I have just now tested 8-bit to 4-bit conversion, 4-bit to 4-bit output, 4-bit to 2- bit output, 1-bit to 4-bit output etc. In windows.
Linux binary needs to be built again.
But it really-diddle-oo should work now.
I opened up your image in GIMP, and added the black/white pattern you see on top to identify the data in the hex editor
Then I saved
Works 100%.
I am now looking at your original file to understand what (yet another) gimmick the BMP format allows
What drawing program did you use?
Edit: yep, I think I see the problemā¦
It was probably mentioned before, but it would be good to allow bmp2pok to convert a bunch of bmp files into a single .c file by including a folder or *.bmp parameter and have it split into tiles inside .c (similar to what we are doing on the rogue like).
This is helpful, because it is much easier to save each tile as its separate file, than to modify the .c file so each tile is itās own array. (hope that makes sense)
Totally agree. That is actually why I am refactoring the code.
There will be a better GUI-based thing for single files, BMP2POK will become a batch-processing tool like you described
@spinal yes, I can do. Also save the palette to json file and allow load from there. Also Iād like to export multiple tiles from a single bmp. Probably Iāll make multiple img variables named āpic_file_name_row_columnā.
Argh. It was not the padding. But it was the ānot divisible by 8ā afterall.
Yep, so padding works in a different way in 4-bit source images. My bad.
Cool. Thanks for looking into it.
I just converted your TileSet.bmp in both windows and linux & ran in the sim at 16-colors (110x88 mode) succesfully. Command : bmp2pok TileSet -4
Problem was that padding in 4-bit and padding in 8-bit BMP source files work slightly differently