Advertisement
here2share

# image_pixel_mapping_demo.py

Aug 18th, 2015
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. # image_pixel_mapping_demo.py
  2.  
  3. from PIL import Image
  4.  
  5. img = Image.new( 'RGB', (255,255)) # create a new image
  6. pixels = img.load() # create the pixel map
  7.  
  8. for i in range(img.size[0]):    # for every pixel:
  9.     for j in range(img.size[1]):
  10.         pixels[i,j] = (i, j, 100) # set the colour accordingly
  11.  
  12. img.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement