class_docstr: Test image conversion outputs.
class_docstr_tok: ["Test","image","conversion","outputs","."]
code: def testConvertResizedSmallDontKeepRatioCenterCrop(self):
      # Verify that we get the desired output image when cropping from center.
  
      # Orig image is a 4 quadrant (200, 200) pixel image, with colors
      # (orange, red, green, yellow) starting from top left and going clockwise.
      orig_img = Image.new("RGBA", (200, 200), self.yellow_rgb)
      orig_img.paste(
          Image.new("RGBA", (100, 100), self.orange_rgb), (0, 0)
      )
      orig_img.paste(
          Image.new("RGBA", (100, 100), self.red_rgb), (100, 0)
      )
      orig_img.paste(
          Image.new("RGBA", (100, 100), self.green_rgb), (100, 100)
      )
  
      conversion_settings = convert.ImageConvertSettings(
          "png",
          self.desired_width,
          self.desired_height,
          preserve_aspect_ratio=False,
      )
  
      # Output image should be 100x100 cropped from the center.
      image_converter = convert.ImageConverter(
          orig_img, conversion_settings
      )
      converted_img = image_converter.convert()
  
      # Top left of output image should be orange.
      self.assertEqual(
          converted_img.getpixel((0, 0))[0:3], self.orange_rgb
      )
      # Top right should be red
      self.assertEqual(
          converted_img.getpixel((99, 0))[0:3], self.red_rgb
      )
      # Bottom right should be green
      self.assertEqual(
          converted_img.getpixel((99, 99))[0:3], self.green_rgb
      )
      # Bottom left should be yellow
      self.assertEqual(
          converted_img.getpixel((0, 99))[0:3], self.yellow_rgb
      )
      # Center section should comprise the same set of colors clockwise.
      self.assertEqual(
          converted_img.getpixel((49, 49))[0:3], self.orange_rgb
      )
      self.assertEqual(
          converted_img.getpixel((50, 49))[0:3], self.red_rgb
      )
      self.assertEqual(
          converted_img.getpixel((50, 50))[0:3], self.green_rgb
      )
      self.assertEqual(
          converted_img.getpixel((49, 50))[0:3], self.yellow_rgb
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl.testing import absltest
  from PIL import Image
  from PIL import ImageColor
  import convert
label_desc: Use image node_id 7 for calling the TestImageConverterTests obj's underlying member method code with example usage: obj.testConvertResizedSmallDontKeepRatioCenterCrop() without return types