Qbasicnews.com

Full Version: pngs, binaries, pics....
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok....I found the structure documentation to png files.

Can anyone help me understand what it means?

Hmmm...8-Byte sig: Well, that's easy.
The chuncks...ummm...

Also how can you read the files in QB?

Linky:

w3c's crap on png file structure

:rotfl:
Mitth':

The chunks are "subfiles" inside the file carrying tables and information you will need to decode the image, one of the chunks carries the image itself. The chunks have a header indicating it's length, then a label indicating the type of information they carry, then the data and at the end there is a CRC, to allow tou to check the integrity of the data.

To read a complex file format like this is not easy.
You must go getting single bytes and building the fields. In fact, you can't read even an integer (two bytes) in a single operation, because Internet is Big endian (most significative byte first) and Intel processors (so QB) are little endian (less significative byte first). Then, when you come to the compressed image itself, you must be able to read single bits in groups of varying size. You must build a state machine knowing at every moment what will come next and how to interpret it.


Give a look to my jpeg viewer http://www.qbasicnews.com/abc/showsnippe...nippet=692 before going into this. It is 1400 lines long....

And dont' forget that formats like PNG, JPEG have been designed with 32bits software or dedicated chips in mind, so making a viewer for one of them in QB can be very rewarding, but you will end with an app slow as hell.
thnx
:wink: