Ask coding questions

← Back to all posts
Decoding
h
DonoldJTrump (9)

Is there any way that I can make python read this png file? I am trying to make a python program that can automatically databend the test.png file. But, when i try to read the file and do a test print it says:

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    x = databend.read()
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
  File "/usr/lib/python3.8/encodings/utf_16.py", line 61, in _buffer_decode
    codecs.utf_16_ex_decode(input, errors, 0, final)
UnicodeDecodeError: 'utf-16-le' codec can't decode bytes in position 98-99: illegal encoding

Even though I am reading from charter 10. Is there any way that i can fix this?

Edit: I have tried the following encodings:

utf-7
utf-8
utf-16
utf-32
ascii
utf-16le
utf-16be
utf-32le
utf-32be
Comments
hotnewtop
xfinnbar (82)

you can use the pypng module: import pypng

DonoldJTrump (9)

@xfinnbar dose it allow me to edit the raw data

DonoldJTrump (9)

@ch1ck3n I mean the raw byte. Do you know how databending works?

You add or move around random bytes that are not in the header and hope it is still renderable

Edit: Profile pic is a databent image. It was a py logo, but it no longer resembles that. If you where to download it, it might look different.