#ezgraphics_image.py #demo ezgraphics create an image file. GIF only. Pixels only. import ezgraphics from random import randint width = int(input("Enter width of image file: ")) height = int(input("Enter height of image file: ")) win = ezgraphics.GraphicsWindow(width,height) #must create a window? img = ezgraphics.GraphicsImage(width,height) #then a new image ''' img.setPixel(100,100, 0,0,0) #row,col i.e. y,x! then RGB decimals img.setPixel(100,200, 255,0,0) img.setPixel(100,250, 0,255,0) ''' # GIF has limit of 256 colors #create almost evenly-spaced sample of 216 all RGB combos: nums = [0,51,102,153,204,255] rgb_sample = [(r,g,b) for r in nums for g in nums for b in nums] print(len(rgb_sample)) for row in range(height): for col in range(width): img.setPixel(row,col, rgb_sample[randint(0,len(rgb_sample)-1)]) img.save("graphicsImageTest.gif","gif")