code: def convert_image(from_file, to_file, image_format):
      
      with Image(filename=from_file) as original:
          with original.convert(image_format) as converted:
              converted.save(filename=to_file)
      return to_file
docs: Convert an image to given format.