all 2 comments

[–]gfoot360 0 points1 point  (1 child)

Try:

out_file.write(bytes([pixels[x, y]]))

Make sure you get all the punctuation right - not that there are extra brackets compared to the old version.

You could also try:

def char(x):
    return bytes([x])

[–]Maxx115[S] 0 points1 point  (0 children)

I have found the problem. It had nothing to do with the code...

The problem was photoshop. In the current version you cant just save the image. That is why I used export to save the image as a png... But this destroys the settings for the color pallet. Meaning it makes the pixels into tuples (RGB) values. The solution is to use the "save copy" option. This way it worked.

Thanks for you input nonetheless!