Graphics To DATA

Previous topic - Next topic


Finally finished the program to convert PNG and BMP files to data statements. 

This program creates RLE hexadecimal data from the graphics and writes a routine to read it all in.

The file created is called temp.gbas

I've also include an example of the output

[attachment deleted by admin]


Exactly what I just was looking for. Good work! :happy:


Quotehave multiple bitmaps processed and dumped within a single file
It does already - just keep adding files!  However, SPR2MEM may sometimes reject it for some reason...

Quoteuser configurable function name(s)
Yes, needs adding...

Quoteuser configurable data segment name(s)
Good idea!


Here is an update to the program that lets you select the output gbas file and the base label name.

The resulting label text is labelname_file processed count, eg : graphic_1, graphic_2 etc

As I've mentioned elsewhere there is a slight problem with SPR2MEM at the moment, as you may well find out, each conversion outputs two bits of text.  These are needed to make sure the SPR2MEM works with more than one sprite  :P

I've also included my test program (to test the resulting code), which rotates through 3 example graphics.

[attachment deleted by admin]


One last update :

  • Write directly to a file instead of buffering and then writing (saves a bit of memory)
  • More detail about how far the data is to being completely compressed

I've been experimenting with file sizes.  The maximum that my graphics card can cope with is 4096x4096, which takes a fair while to compress and 29 seconds to decompress if its all one colour.  A file 5460 x 8730 wont load correctly and thus wont compress correctly.

[attachment deleted by admin]


It would need to be an option - as transfer from main memory to graphics card is slow, it wouldn't be an ideal default :)

Kitty Hello

The bottleneck on your img 2 data program is the compression algo. I see if there's anything I could speed up.


That would be handy if you can...