class_docstr: Test image conversion outputs.
class_docstr_tok: ["Test","image","conversion","outputs","."]
code: def testConvertResizedSmallTopLeftKeepRatio(self):
      # Same as above but we specify that the position remains in the top left.
      # Verify that for an original red rectangular (vertically long image),
      # after conversion to a square size with blue background the output image
      # looks correct based on sampling color at several locations.
      orig_img = Image.new("RGBA", (50, 500), self.red_rgb)
      conversion_settings = convert.ImageConvertSettings(
          "png", 100, 100, position=(0, 0), bg_color_rgb=self.blue_rgb
      )
  
      # Final image should be a 10px wide by 100px tall rectangle flush with
      # the left edge of the output size. I.e., rectangle with center at pixel
      # (4, 49) and the blue background staring at x position 9.
      image_converter = convert.ImageConverter(
          orig_img, conversion_settings
      )
      converted_img = image_converter.convert()
  
      # Just compare the RGB values, not opacity
      # Center of image should be blue
      self.assertEqual(
          converted_img.getpixel((45, 45))[0:3], self.blue_rgb
      )
      # Top left corner should be red
      self.assertEqual(
          converted_img.getpixel((0, 0))[0:3], self.red_rgb
      )
      # Bottom right corner of rectangle along with adjacent blue background
      self.assertEqual(
          converted_img.getpixel((9, 99))[0:3], self.red_rgb
      )
      self.assertEqual(
          converted_img.getpixel((10, 99))[0:3], self.blue_rgb
      )
      # Right edge of image should be background color
      self.assertEqual(
          converted_img.getpixel((45, 99))[0:3], self.blue_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 4 for calling the TestImageConverterTests obj's underlying member method code with example usage: obj.testConvertResizedSmallTopLeftKeepRatio() without return types