GLBasic forum

Main forum => Beta Tests => Topic started by: MrTAToad on 2010-Jul-10

Title: Graphics To DATA
Post by: MrTAToad on 2010-Jul-10
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]
Title: Re: Graphics To DATA
Post by: monono on 2010-Jul-11
Exactly what I just was looking for. Good work! :happy:
Title: Re: Graphics To DATA
Post by: MrTAToad on 2010-Jul-11
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!
Title: Re: Graphics To DATA
Post by: MrTAToad on 2010-Jul-11
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]
Title: Re: Graphics To DATA
Post by: MrTAToad on 2010-Jul-13
One last update :


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]
Title: Re: Graphics To DATA
Post by: MrTAToad on 2010-Jul-13
It would need to be an option - as transfer from main memory to graphics card is slow, it wouldn't be an ideal default :)
Title: Re: Graphics To DATA
Post by: Kitty Hello on 2010-Jul-14
The bottleneck on your img 2 data program is the compression algo. I see if there's anything I could speed up.
Title: Re: Graphics To DATA
Post by: MrTAToad on 2010-Jul-14
That would be handy if you can...