class_docstr: Converter for images
class_docstr_tok: ["Converter","for","images"]
docstr: Returns a converted image as a PIL Image object.
docstr_tok: ["Returns","a","converted","image","as","a","PIL","Image","object","."]
code: def convert(self):
      """Returns a converted image as a PIL Image object."""
      # TODO: Do we need an option to allow pre-cropping?
      if (
          self._orig_img.size == self._desired_size
          and self._orig_img.format == self._desired_format.upper()
      ):
          logging.debug(
              "Desired image is same format and size as original image"
              "so no conversion needed."
          )
          return self._orig_img
  
      # Desired image is larger than original image.
      if (
          self._desired_size[0] > self._orig_img.size[0]
          and self._desired_size[1] > self._orig_img.size[1]
      ):
          if self._preserve_aspect_ratio and self._resize_if_larger:
              return self._resize_larger_keep_aspect_ratio()
          elif self._resize_if_larger:
              return self._resize_larger_dont_keep_aspect_ratio()
          return self._pad_to_larger_size()
  
      if self._preserve_aspect_ratio:
          return self._resize_thumbnail_keep_aspect_ratio()
      return self._resize_thumbnail_and_crop()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl import logging
  from PIL import Image
  from PIL import ImageOps
label_desc: Use image node_id 2 for calling the ImageConverter obj's underlying member method code with example usage: obj.convert() and returns: self, self, self, self, self, self