code: def create_image(self, image_file, caption):
          
          suffix = 'png'
          if image_file:
              img = Image.open(os.path.join(self.gallery, image_file))
              width, height = img.size
              ratio = width/WIDTH
              img = img.resize((int(width // ratio),
                                int(height // ratio)),
                               Image.ANTIALIAS)
          else:
              img = Image.new('RGB', (WIDTH, HEIGHT), 'black')
              image = self.add_caption(img, caption)
              
          image = img
  
          return image
docs: Create an image with a caption