code: def transform_pil_image(self, pil_image):
          '''
          Uses :py:meth:`PIL.Image.Image.transform` to scale
          down the image.
  
          Based on `this stackoverflow discussions <http://stackoverflow.com/a/940368/907060>`_, uses
          :attr:`PIL.Image.ANTIALIAS`
          '''
          max_width = min(self.dimensions[0] or float('inf'), pil_image.size[0])
          max_height = min(self.dimensions[1] or float('inf'), pil_image.size[1])
          max_dimensions = (max_width, max_height)
  
          pil_image.thumbnail(max_dimensions, Image.ANTIALIAS)
          return pil_imagf transform_pil_image(self, pil_image):
          '''
          Uses :py:meth:`PIL.Image.Image.transform` to scale
          down the image.
  
          Based on `this stackoverflow discussions <http://stackoverflow.com/a/940368/907060>`_, uses
          :attr:`PIL.Image.ANTIALIAS`
          '''
          max_width = min(self.dimensions[0] or float('inf'), pil_image.size[0])
          max_height = min(self.dimensions[1] or float('inf'), pil_image.size[1])
          max_dimensions = (max_width, max_height)
  
          pil_image.thumbnail(max_dimensions, Image.ANTIALIAS)
          return pil_image
docs: Uses :py:meth:`PIL.Image.Image.transform` to scale
          down the image.
  
          Based on `this stackoverflow discussions <http://stackoverflow.com/a/940368/907060>`_, uses
          :attr:`PIL.Image.ANTIALIAS`