Datasheet

display is selected by default. For other displays, go ahead and comment out the line that starts with:
display = Adafruit_IL0373(104, 212, spi,
and uncomment the line appropriate for your display.
#display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
#display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
#display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
#display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
#display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
#display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
rst_pin=rst, busy_pin=busy)
Uncomment the next two lines if you have a flexible display. This tells the library to change a couple of settings so that
it is writing the correct colors to the correct places.
# IF YOU HAVE A FLEXIBLE DISPLAY (2.13" or 2.9") uncomment these lines!
#display.set_black_buffer(1, False)
#display.set_color_buffer(1, False)
Next we tall the display the rotation setting we want to use. This can be a value between 0-3 .
display.rotation = 1
Next we open the Blinka image, which we've named blinka.jpg, which assumes it is in the same directory that you are
running the script from. Feel free to change it if it doesn't match your configuration.
image = Image.open("blinka.png")
Here's where it starts to get interesting. We want to scale the image so that it matches either the width or height of the
display, depending on which is smaller, so that we have some of the image to chop off when we crop it. So we start by
calculating the width to height ration of both the display and the image. If the height is the closer of the dimensions, we
want to match the image height to the display height and let it be a bit wider than the display. Otherwise, we want to
do the opposite.
Once we've figured out how we're going to scale it, we pass in the new dimensions and using a Bicubic rescaling
method, we reassign the newly rescaled image back to image . Pillow has quite a few different methods to choose
from, but Bicubic does a great job and is reasonably fast.
Nearest actually gives a little better result with the Tri-color eInks, but loses detail with displaying a color image on the
monochrome display, so we decided to go with the best balance.
© Adafruit Industries https://learn.adafruit.com/adafruit-eink-display-breakouts Page 48 of 61