Created
August 4, 2018 04:42
-
-
Save GiantRobato/e96c46253c06635ec5cb51291e28430b to your computer and use it in GitHub Desktop.
unpacks rgb data using python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zlib | |
import struct | |
#in while loop | |
try: | |
chunkType = bytes(chunkType).decode('utf-8') | |
if chunkType == 'IDAT': | |
deflated = zlib.decompress(data) | |
(a,r,g,b) = struct.unpack('<BBBB',deflated) | |
print('argb value is: [{},{},{},{}]'.format(a,r,g,b)) | |
except Exception as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment