How to decompress base64 zlib data in Python?

I have tile map graphical data compressed with <encoding=“base64” compression=“zlib”>. And in python, I’m trying to decompress that to get back the original data as a readable string or an array of nums.

The compressed data is “eJwNw4cNAAAIw7Cy4f+HiSWbJGcwWWwOl8cHArgALg==”

And after decompression, it should return to “1, 2, 3, 4, 5, 6, 7, 8, 9”

However, I’m failing (attached 2 pictures). I feel like I’m missing something very simple…

Would appreciate the help!


After you decompress, you have binary data, you need to interpret it as an array of unsigned 32-bit integers, e.g. using frombuffer() from numpy.

1 Like

Thank you very much!

Turns out I was also missing a call to zlib decompress. Posting the solution for posterity.

1 Like