Jump to content

- - - - -

IEND byte stream significance in PNG file format?

  • Please log in to reply
No replies to this topic

#1 AceInfinity


    Frequent Member

  • Team Reboot
  • 228 posts
  • Location:Canada
  • Interests:Windows Security, Programming, Customizing & Crash Dump Analysis.

Posted 03 January 2012 - 10:45 AM

So far i'm reading that it is a critical sector of a PNG file and always supposed to remain as the last thing in the PNG structure, because it marks the end of the PNG data stream, but all of my tests up until now have proved it almost useless. Is there anyone who can give me a reason and possibly an example to why it's important. When removing those last 12 bytes that mark the IEND chunk of data, i'm still able to open the PNG file with Windows Live Gallery, edit the file in photoshop, save using the right click option, and download the file with curl no problem from my localhost and a regular webserver no on my local computer (tech.reboot.pro).

It makes no sense to me as to why it's critical at all...

You've got the PNG file signature, which is the first few bytes of every PNG file:
0x137 0x80 0x78 0x71 0x13 0x10 0x26 0x10

Then you've got your IHDR data, and all the other arbitrary junk data in there along with the IDAT (actual image data) chunks, and then maybe some text data and finally the IEND bytes.

The CRC in my files without it seems to be stable. Each bit of the IEND chunk points towards the fact that the Ancillary bit is 0, along with the Private, Reserved, and Safe-to-copy bits as well, being that they are all uppercase.

Anyone know the importance of IEND in the PNG file format?

Edit: I now understand it's importance, and I believe it has to do with streaming the bytes. If they are read through an interpreter IEND defines when it should end the PNG datastream so you don't over read or under-read it's data. An example of this I encountered was with image uploading sites a few minutes ago. Uploading did not work with the last 12 bytes removed from the IEND data chunk. I would presume that the uploader needs to be able to read through the bytes until it finds the IEND signature in there so it knows when the data for the PNG file starts and ends during the data transfer. It basically writes the bytes and adds it to the site's database in this way, so i'm sure the uploader has a built in entry to identify PNG files by the IEND signature as well as the unvariant bytes in the beginning of the PNG file.

I am sure this only happens when the bytes have to be read for streaming in a selection of interpreters however as photoshop and windows live gallery had no problem identifying the file's data (with or) without it. And I was able to view the image on a webserver if it was uploaded directly, and not through some script on a webpage. I would have to look into this further, but I finally came across an event that proved IEND valuable. Regardless, how IEND is read remains a mystery to me as it has only caused an error once for me.

Edit: I realized that I might have posted this in the wrong area. But this is for a project i'm making, just not the project itself, so maybe I'll post a preview of it here to keep things on the proper track. I should have posted this in the community area though. I was unsure where something like this would go at first.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users