Qbasicnews.com
April 08, 2020, 12:57:23 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: pngs, binaries, pics....  (Read 1647 times)
Mitth'raw'nuruodo
Ancient Guru
****
Posts: 515



WWW
« on: April 07, 2005, 05:37:34 PM »

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:
Logged

i]"But...it was so beautifully done"[/i]
Antoni Gual
Na_th_an
*****
Posts: 1434



WWW
« Reply #1 on: April 07, 2005, 06:26:14 PM »

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/showsnippet.php?filename=GRAPHICS.ABC&snippet=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.
Logged

Antoni
Mitth'raw'nuruodo
Ancient Guru
****
Posts: 515



WWW
« Reply #2 on: April 08, 2005, 04:35:02 PM »

thnx
 :wink:
Logged

i]"But...it was so beautifully done"[/i]
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!