Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: do %image.png

From: pwoodward:cncdsl at: 14-Nov-2001 17:40

Hey - have you checked out the PNG spec? It's pretty clear about how the file is arranged. Basically using a combination of read/part/skip you should be able to navigate thru the various chunks to get to the chunk you want. The first 4 bytes of a chunk indicate its length, and the next 4 indicate the chunk type. So - after reading the first 8 bytes of the file to verify it's a PNG, read the next 8 bytes and take a look at them to see if the next chunk is a "tEXt" chunk - if not use the length value as the skip in a read... You'll have to accumulate bytes read and what not though. But - it'd avoid you having to scan thru the file for an identifier. - Porter