I want to work on an idea using images, but I cannot get it to write pixel values correctly, it always ends in gray with some pattern similar to artifacts, and no matter what I try, the artifacts change, but the image remains gray.
Here is the basic code I have:
from PIL import Image data = "" for i in range( 128**2 ): data += "(255,0,0)," im = Image.fromstring("RGB", (128,128), data) im.save("test.png", "PNG")
There is no information in http://effbot.org/imagingbook/pil-index.htm on how to format data , so I tried using 0-1, 0- 255, 00000000-111111111 (binary), brackets, square brackets, without brackets, an extra value for alpha and changing RGB to RGBA (which makes it light gray, but it is), a comma after and without a comma, but absolutely nothing worked.
For the record, I don’t want to just store one color, I just do it to initially make it work.
Peter source share