title: Difficulty in resizing image for OLED display
body: <p>I am trying to resize an image to display on my OLED device. </p>
  
  <p>My image I want to display is:
  <a href="https://i.stack.imgur.com/faSJ8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/faSJ8.jpg" alt="enter image description here"></a></p>
  
  <p>Currently, my OLED display only shows a fraction of the image:
  <a href="https://i.stack.imgur.com/k2vqQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k2vqQ.jpg" alt="enter image description here"></a></p>
  
  <p>Based on <a href="https://stackoverflow.com/questions/37631611/how-to-resize-image">How to resize image?</a>, I added <code>new_img = img.resize((128,128))</code> to my script to resize the image. The same fraction of the image however appears on the screen. When I tried to enter a lower image size for the resize argument (64x64), terminal prints:</p>
  
  <pre><code>pi@raspberrypi:~/project $ python colors.py --display ssd1351 --width 128 --height 128 --interface spi --spi-bus-speed 16000000 --gpio-data-command 20
  Version: luma.oled 2.3.1 (luma.core 1.3.0)
  Display: ssd1351
  Interface: spi
  Dimensions: 128 x 128
  ------------------------------------------------------------
  Traceback (most recent call last):
    File "colors.py", line 87, in &lt;module&gt;
      main()
    File "colors.py", line 30, in main
      device.display(new_img)
    File "/usr/local/lib/python2.7/dist-packages/luma/oled/device.py", line 371, in display
      assert(image.size == self.size)
  AssertionError
  </code></pre>
  
  <p>Any ideas on how I can resize the image properly for the OLED display?</p>
  
  <p>My full script is:</p>
  
  <pre><code>#!/usr/bin/env python
  
  import math
  import time
  import random
  import os.path
  from demo_opts import get_device
  from luma.core.render import canvas
  from PIL import Image
  
  
  def main():
      img_path = os.path.abspath(os.path.join(
          os.path.dirname(__file__), 'plot.jpg'))
      img = Image.open(img_path) \
          .transform(device.size, Image.AFFINE, (1, 0, 0, 0, 1, 0), Image.BILINEAR) \
          .convert(device.mode)
      new_img = img.resize((128,128))
  
      while True:
          # Image display
          device.display(new_img)
          time.sleep(5)
  
  
  
  if __name__ == "__main__":
      try:
          device = get_device()
          main()
      except KeyboardInterrupt:
          pass
  </code></pre>