canid

image pixel rgb list

Aug 4th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. from PIL import Image
  2. im = Image.open('tehinternets.jpg')
  3. print im.mode
  4. pixels = list(im.getdata())
  5. width, height = im.size
  6. print "Width: "+str(width)
  7. print "Height: "+str(height)
  8.  
  9. pixels = im.load() # this is not a list, nor is it list()'able
  10.  
  11. all_pixels = []
  12. for x in range(width):
  13.     for y in range(height):
  14.         cpixel = pixels[x, y]
  15.         all_pixels.append(cpixel)
  16. print all_pixels
Advertisement
Add Comment
Please, Sign In to add comment