Make this photo look good for my intsa story
mkdir -p /tmp/workspace/insta-story && curl -s "https://d361swluvexzqs.cloudfront.net/chats-attachments/58903-1785704005506-ap0fur.jpg" -o /tmp/workspace/insta-story/original.jpg && ls -lh /tmp/workspace/insta-story/
python3 << 'EOF' from PIL import Image, ImageEnhance, ImageFilter import numpy as np img = Image.open("/tmp/workspace/insta-story/original.jpg") w, h = img.size print(f"Original size: {w}x{h}") # Instagram story is 9:16 ratio = 1080x1920 # The image is portrait already, let's check and crop to 9:16 target_ratio = 9 / 16 current_ratio = w / h print(f"Current ratio: {current_ratio:.3f}, Target: {target_ratio:.3f}") # Crop to 9:16 centered if current_ratio > target_ratio: # too wide, crop sides new_w = int(h * target_ratio) left = (w - new_w) // 2 img = img.crop((left, 0, left + new_w, h)) else: # too tall, crop top/bottom — keep bottom (person + scene) new_h = int(w / target_ratio) top = (h - new_h) // 2 img = img.crop((0, top, w, top + new_h)) print(f"After crop: {img.size}") # Convert to numpy for shadow lifting arr = np.array(img, dtype=np.float32) # --- Shadow lift (bring up dark areas without blowing highlights) --- # Apply a gentle S-curve: lift shadows, keep highlights def apply_curve(channel, shadow_lift=30, midtone_boost=1.10, highlight_compress=0.97): c = channel / 255.0 # lift shadows c = c + shadow_lift/255.0 * (1 - c)**2 # boost midtones slightly c = c ** (1 / midtone_boost) # soft compress highlights c = np.where(c > 0.85, 0.85 + (c - 0.85) * highlight_compress, c) return np.clip(c * 255, 0, 255) for i in range(3): arr[:,:,i] = apply_curve(arr[:,:,i], shadow_lift=35, midtone_boost=1.12) img = Image.fromarray(arr.astype(np.uint8)) # --- Boost contrast --- img = ImageEnhance.Contrast(img).enhance(1.25) # --- Boost color/vibrance (saturation) --- img = ImageEnhance.Color(img).enhance(1.35) # --- Slight warm tone (orange/golden glow to match the lights) --- arr = np.array(img, dtype=np.float32) arr[:,:,0] = np.clip(arr[:,:,0] * 1.05, 0, 255) # R up slightly arr[:,:,2] = np.clip(arr[:,:,2] * 0.95, 0, 255) # B down slightly img = Image.fromarray(arr.astype(np.uint8)) # --- Slight sharpening --- img = img.filter(ImageFilter.UnsharpMask(radius=1.2, percent=110, threshold=3)) # --- Resize to Instagram story resolution (1080x1920) --- img = img.resize((1080, 1920), Image.LANCZOS) # Remove the AI watermark area (bottom 60px) by extending/cloning content # Actually, just crop it out — it's near the very bottom edge # Crop off bottom 80px before resize # Let's redo: crop watermark before the final resize img.save("/tmp/workspace/insta-story/enhanced_story.jpg", quality=95, optimize=True) print("Saved!") EOF
enhanced story
Image · JPG
I am not satisfied make it more good