Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 understanding output of bytes/raw data
I can see that the output of this has some interesting info... such as Created With Gimp Big Grin How can I extract useful information out of s[6]? Or is that just the image data itself? What do the 0th-5th elements represent?

import struct
from requests import get

struct_fmt = '=5if255s'
struct_len = struct.calcsize(struct_fmt)
struct_unpack = struct.Struct(struct_fmt).unpack_from
url_img = ''
# print(struct_unpack(get(url_img).content))
s = struct_unpack(get(url_img).content)

edit: here's what the output looks like:

(1196314761, 169478669, 218103808, 1380206665, 1912602624, 2.535301200456459e+30, b'\x08\x02\x00\x00\x00\x00\xbf\x12*\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07tIME\x07\xe1\t\x01\x0b\x12 \xeb\xaf\xd8i\x00\x00\x00\x19tEXtComment\x00Created with GIMPW\x81\x0e\x17\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x1d\x8cIDATx\xda\xed]\tX\x8di\xfb\x7f\xf7};\xed\xda7[\n\x91\xa5E\xb6\xc1XC\x12\x91"\xb2\x84"\x8d\xa5\x88,1v\t\x83\xa1Bv#\x94\xad\x184*r\xea\x98\xe5\xfb\xbe\x99o\x86\xebb\x98\x19\xe3\xfbf|\x98\xc1\x98\xff\xffy:iB\xa7\xe5tZ\x18\xe7z.\xd7\xd1\xe9<\xbd\xef\xef\xb9\x9f\xfb\xf9\xdd\xeb\x8b\xfc_\x1d\xbc\xee\xdd\xbbW\\\\\x9c}\xf6lNv\xf6W_}\xf5\xc3\x0f?<y\xf2D\xef\xd9\x9e={\x06\xbe\xfe\xf4\xe9S\xf0\xe6\xf9\xf3\xe7\x7f\xfe\xf9')

maybe this information would help you
For such a problem, I would look into pypi to find packages related to png or to metadata. For example you have this package ipng. In the source code there are interesting considerations about the contents of the png format and you see that zlib.decompress() is involved in retrieving the metadata.
both great answers thank you

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  List of mixed data types to bytes medatib531 1 142 Mar-16-2020, 11:53 AM
Last Post: scidam
  replace bytes with other byte or bytes BigOldArt 1 724 Feb-02-2019, 11:00 PM
Last Post: snippsat
  Retrieve data from Terminal output or from an ASE variable. DreamingInsanity 0 606 Jul-08-2018, 05:51 PM
Last Post: DreamingInsanity
  Storing Python data output as a Netcdf file Lightning1800 1 761 May-16-2018, 10:14 PM
Last Post: micseydel
  Understanding "help()" output? Athenaeum 4 1,333 Sep-29-2017, 09:47 PM
Last Post: nilamo
  help on understanding this output landlord1984 1 1,135 Mar-08-2017, 08:29 PM
Last Post: zivoni

Forum Jump:

Users browsing this thread: 1 Guest(s)