PNG file format endianness?

后端 未结 2 1023
失恋的感觉
失恋的感觉 2020-12-20 11:07

Im not sure if endian is the right word but..

I have been parsing through a PNG file and I have noticed that all of the integer values are in big endian. Is this tru

相关标签:
2条回答
  • Integers in PNG are in network byte order (big endian).

    See: the spec.

    0 讨论(0)
  • 2020-12-20 11:49

    Yes, according to the specification, integers must be in network byte order (big endian):

    All integers that require more than one byte shall be in network byte order: the most significant byte comes first, then the less significant bytes in descending order of significance (MSB LSB for two-byte integers, MSB B2 B1 LSB for four-byte integers). The highest bit (value 128) of a byte is numbered bit 7; the lowest bit (value 1) is numbered bit 0. Values are unsigned unless otherwise noted. Values explicitly noted as signed are represented in two's complement notation.

    http://www.w3.org/TR/2003/REC-PNG-20031110/#7Integers-and-byte-order

    0 讨论(0)
提交回复
热议问题