code: def image(self, image):
          
          if image.mode != '1':
              raise ValueError('Image must be in mode 1.')
          imwidth, imheight = image.size
          if imwidth != self.width or imheight != self.height:
              raise ValueError('Image must be same dimensions as display ({0}x{1}).' \
                  .format(self.width, self.height))
          # Grab all the pixels from the image, faster than getpixel.
          pix = image.load()
          # Iterate through the memory pages
          index = 0
          for page in range(self._pages):
              # Iterate through all x axis columns.
              for x in range(self.width):
                  # Set the bits for the column of pixels at the current position.
                  bits = 0
                  # Don't use range here as it's a bit slow
                  for bit in [0, 1, 2, 3, 4, 5, 6, 7]:
                      bits = bits << 1
                      bits |= 0 if pix[(x, page*8+7-bit)] == 0 else 1
                  # Update buffer byte and increment to next byte.
                  self._buffer[index] = bits
                  index += 1
docs: Set buffer to value of Python Imaging Library image.  The image should
          be in 1 bit mode and a size equal to the display size.