def encode_image(self, image):
        """Encode an image into base64 and return its mime type."""
        mime_type = "image/jpeg"
        image_format = "JPEG"

        if image.mode == "RGBA":
            image = self._rgba_to_rgb(image)

        if self.resize and max(image.size) > self.max_side:
            image = self._resize_image(image)
            encoded_image = self._encode_image(image, image_format)
        else:
            encoded_image = self._encode_image(image, image_format)

        return encoded_image, mime_type
Encode an image into base64 and return its mime type.
vlmeval/dataset/utils/megabench/scoring/ascii_art_gpt4o_judge.py