At bottom add presented by :- R Darshan
ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && ls -la /tmp/workspace/
mkdir -p /tmp/workspace/arjuna && cd /tmp/workspace/arjuna && curl -s -o original.jpg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1000174891-1784621582656-0i46b6.jpg" && echo "Downloaded: $(ls -lh original.jpg)"
cd /tmp/workspace/arjuna && python3 << 'EOF' from PIL import Image, ImageDraw, ImageFont import os # Open original image img = Image.open("original.jpg").convert("RGB") w, h = img.size print(f"Original size: {w}x{h}") # Add extra space at bottom for the text padding = 70 new_img = Image.new("RGB", (w, h + padding), (255, 255, 255)) new_img.paste(img, (0, 0)) draw = ImageDraw.Draw(new_img) # Try to load a nice font, fallback to default font = None font_paths = [ "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", "/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", "/usr/share/fonts/truetype/freefont/FreeSansBold.ttf", ] for fp in font_paths: if os.path.exists(fp): font = ImageFont.truetype(fp, 36) print(f"Using font: {fp}") break if font is None: font = ImageFont.load_default() print("Using default font") text = "Presented by :- R Darshan" # Center the text bbox = draw.textbbox((0, 0), text, font=font) text_w = bbox[2] - bbox[0] text_h = bbox[3] - bbox[1] x = (w - text_w) // 2 y = h + (padding - text_h) // 2 # Draw text in dark green to match the theme draw.text((x, y), text, font=font, fill=(34, 100, 34)) new_img.save("arjuna_presented.jpg", quality=95) print(f"Saved: arjuna_presented.jpg ({os.path.getsize('arjuna_presented.jpg')//1024} KB)") EOF
find /usr/share/fonts -name "*.ttf" 2>/dev/null | head -20
cd /tmp/workspace/arjuna && python3 << 'EOF' from PIL import Image, ImageDraw, ImageFont import os img = Image.open("original.jpg").convert("RGB") w, h = img.size padding = 80 new_img = Image.new("RGB", (w, h + padding), (255, 255, 255)) new_img.paste(img, (0, 0)) draw = ImageDraw.Draw(new_img) # Use DroidSans-Bold which is available font = ImageFont.truetype("/usr/share/fonts/google-droid-sans-fonts/DroidSans-Bold.ttf", 42) text = "Presented by :- R Darshan" bbox = draw.textbbox((0, 0), text, font=font) text_w = bbox[2] - bbox[0] text_h = bbox[3] - bbox[1] x = (w - text_w) // 2 y = h + (padding - text_h) // 2 # Dark green matching the poster theme draw.text((x, y), text, font=font, fill=(34, 100, 34)) new_img.save("arjuna_presented.jpg", quality=95) print(f"Done! Size: {w}x{h+padding}, text at ({x},{y})") EOF
arjuna presented
Image · JPG
Add background color with textsfor
cd /tmp/workspace/arjuna && python3 << 'EOF' from PIL import Image, ImageDraw, ImageFont import os img = Image.open("original.jpg").convert("RGB") w, h = img.size padding = 80 new_img = Image.new("RGB", (w, h + padding), (255, 255, 255)) new_img.paste(img, (0, 0)) draw = ImageDraw.Draw(new_img) # Draw a background bar for the text (golden/yellow to complement the green theme) bar_color = (34, 100, 34) # dark green bar text_color = (255, 255, 255) # white text on green draw.rectangle([0, h, w, h + padding], fill=bar_color) font = ImageFont.truetype("/usr/share/fonts/google-droid-sans-fonts/DroidSans-Bold.ttf", 42) text = "Presented by :- R Darshan" bbox = draw.textbbox((0, 0), text, font=font) text_w = bbox[2] - bbox[0] text_h = bbox[3] - bbox[1] x = (w - text_w) // 2 y = h + (padding - text_h) // 2 draw.text((x, y), text, font=font, fill=text_color) new_img.save("arjuna_final.jpg", quality=95) print(f"Saved arjuna_final.jpg — size: {w}x{h+padding}") EOF
arjuna final
Image · JPG
Merge color with background
cd /tmp/workspace/arjuna && python3 << 'EOF' from PIL import Image, ImageDraw, ImageFont import numpy as np img = Image.open("original.jpg").convert("RGB") w, h = img.size padding = 90 # Sample the bottom edge color of the original image to blend from img_arr = np.array(img) # Average color of the bottom 10 rows bottom_color = img_arr[h-10:h, :, :].mean(axis=(0,1)).astype(int) print(f"Bottom edge color: {tuple(bottom_color)}") # Target color for the bar (dark green) target = np.array([34, 100, 34]) # Create gradient: from bottom_color (top of bar) to target (bottom of bar) gradient = np.zeros((padding, w, 3), dtype=np.uint8) for i in range(padding): alpha = i / (padding - 1) # 0 = top (matches poster bottom), 1 = full green color = ((1 - alpha) * bottom_color + alpha * target).astype(np.uint8) gradient[i, :, :] = color # Build new image new_arr = np.zeros((h + padding, w, 3), dtype=np.uint8) new_arr[:h, :, :] = img_arr new_arr[h:, :, :] = gradient new_img = Image.fromarray(new_arr) draw = ImageDraw.Draw(new_img) font = ImageFont.truetype("/usr/share/fonts/google-droid-sans-fonts/DroidSans-Bold.ttf", 42) text = "Presented by :- R Darshan" bbox = draw.textbbox((0, 0), text, font=font) text_w = bbox[2] - bbox[0] text_h = bbox[3] - bbox[1] x = (w - text_w) // 2 y = h + (padding - text_h) // 2 # White text with a subtle dark shadow for readability draw.text((x+2, y+2), text, font=font, fill=(0, 50, 0)) # shadow draw.text((x, y), text, font=font, fill=(255, 255, 255)) # white text new_img.save("arjuna_merged.jpg", quality=95) print(f"Saved arjuna_merged.jpg — {w}x{h+padding}") EOF
arjuna merged
Image · JPG
Maintain same color everywhere
cd /tmp/workspace/arjuna && python3 << 'EOF' from PIL import Image, ImageDraw, ImageFont import numpy as np img = Image.open("original.jpg").convert("RGB") w, h = img.size img_arr = np.array(img) # Sample the background color from a clean area (top-right corner, avoiding logo) # and bottom area - average them to get the true background sample1 = img_arr[10:60, w//2:w-10, :] # top middle sample2 = img_arr[h-30:h, 10:w//2, :] # bottom left bg_color = np.concatenate([sample1.reshape(-1,3), sample2.reshape(-1,3)], axis=0).mean(axis=0).astype(int) print(f"Detected background color: {tuple(bg_color)}") # Use that exact color for the added strip bg = tuple(bg_color) padding = 90 new_img = Image.new("RGB", (w, h + padding), bg) new_img.paste(img, (0, 0)) draw = ImageDraw.Draw(new_img) # Fill bottom strip with same bg color (already set, just to be explicit) draw.rectangle([0, h, w, h + padding], fill=bg) font = ImageFont.truetype("/usr/share/fonts/google-droid-sans-fonts/DroidSans-Bold.ttf", 44) text = "Presented by :- R Darshan" bbox = draw.textbbox((0, 0), text, font=font) text_w = bbox[2] - bbox[0] text_h = bbox[3] - bbox[1] x = (w - text_w) // 2 y = h + (padding - text_h) // 2 # Use dark green text (matches the poster's heading color) draw.text((x, y), text, font=font, fill=(34, 100, 34)) new_img.save("arjuna_seamless.jpg", quality=95) print(f"Saved arjuna_seamless.jpg — {w}x{h+padding}") EOF
arjuna seamless
Image · JPG