import sys, os
sys.stdout = open(1, 'w', encoding='utf-8', closefd=False)
from PIL import Image
import pillow_heif
pillow_heif.register_heif_opener()
img = Image.open('C:/Users/YZKJ/.openclaw/media/inbound/IMG_9220---187cb16b-22fd-4a00-9f5b-c22936adc3a9.heic')
w, h = img.size
ratio = 400 / w
img = img.resize((400, int(h * ratio)), Image.LANCZOS)
out_path = 'C:/Users/YZKJ/.openclaw/workspace/drink-photo.jpg'
img.save(out_path, 'JPEG', quality=85)
print(f'Resized: {img.size}')
size_kb = os.path.getsize(out_path) / 1024
print(f'File size: {size_kb:.0f} KB')
