python - PIL library Image.fromarray() causes ...
https://stackoverflow.com/questions/5026588810.05.2018 · This script creates a flat list of R, G, B, A values. It uses a Python 3 bytes object, so it won't work properly on Python 2.. from PIL import Image maxval = 255 width, height = 400, 300 # Display size info size = width * height fmt = 'Width: {}, Height: {}, Pixels: {}, Bytes: {}' print(fmt.format(width, height, size, size * 4)) # Make a 2D gradient that starts at black in the …