from PIL import Image, ImageDraw, ImageFont import base64 from io import BytesIO def split_image(image: Image.Image, num_chunks: int) -> list: width, height = image.size chunk_height = height // num_chunks chunks = [] for i in range(num_chunks): top = i * chunk_height bottom = (i + 1) * chunk_height if i < num_chunks - 1 else height chunks.append(image.crop((0, top, width, bottom))) return chunks def encode_image_to_html(image: Image.Image) -> str: buffered = BytesIO() image.save(buffered, format="PNG") encoded = base64.b64encode(buffered.getvalue()).decode() return f"""
"""