import base64 from PIL import Image import io # Função para redimensionar, comprimir e converter para Base64 def compress_and_encode_image(image_path, max_width=800): with Image.open(image_path) as img: # Redimensiona mantendo proporção if img.width > max_width: height = int((max_width / img.width) * img.height) img = img.resize((max_width, height)) buffer = io.BytesIO() img.save(buffer, format="JPEG", quality=70) encoded_string = base64.b64encode(buffer.getvalue()).decode("utf-8") return encoded_string # Caminhos das imagens img1_path = "/mnt/data/4974287039415561898.jpg" img2_path = "/mnt/data/4974287039415561897.jpg" # Processar as imagens img1_b64 = compress_and_encode_image(img1_path) img2_b64 = compress_and_encode_image(img2_path) # Montar o HTML com as imagens embutidas html_content = f"""
Você nunca viu nada igual. Larinha te mostra o lado mais quente do proibido. Seja curioso, mas prepare-se para se viciar.