title: Python 3.5 - Pillow - Pixel Acces
body: <p>I want to write a program that compares 2 images (o small one, and a bigger one) to check if the small one is within the big one.</p>
  
  <p>Knowing that an image can be compared to an array , i have written the following algorithm : </p>
  
  <pre><code>big_image = [
      [1,2,3,4,5,6,7,8,9],
      [10,11]
  ]
  
  small_image = [
      [1,2],
      [10,11]
  ]
  big_result = []
  def check(small_image,  big_image):
      for i in range(len(small_image)):
          for j in range(len(small_image[i])):
              if small_image[i][j] ==  big_image[i][j]:
                  result = (i,j)
                  big_result.append(result)
      return(big_result)
  
  print(check(small_image, big_image))
  </code></pre>
  
  <p>It printed out : <code>[(0, 0), (0, 1), (1, 0), (1, 1)]</code> , as intended .</p>
  
  <p>After that I installed the Pillow module to test the algorithm on 2 actual images (.bmp format) . </p>
  
  <p>My question is how do I access the pixels in the image and how do I get the image.width and the image.height so I can test my algorithm. </p>
  
  <p>I did checked the official pillow tutorial (<a href="http://pillow.readthedocs.io/en/3.1.x/handbook/tutorial.html" rel="nofollow noreferrer">http://pillow.readthedocs.io/en/3.1.x/handbook/tutorial.html</a>) , but all I could find is how to turn around and image , crop it and such .</p>