Can yo8 c
Can you change the place of groom and bride with sign in the same place as it and increase the quality of this picture
Just to confirm — you want to swap the names so that 'Dr. Fatima Hassan' appears where 'Dr. Saad Rafi' is, and vice versa? And keep their signatures in the same left/right positions?
No name should be in thier place only change the groom and bride the sign
mkdir -p /tmp/workspace/nikah-cert && curl -s -o /tmp/workspace/nikah-cert/original.jpeg "https://d361swluvexzqs.cloudfront.net/chats-attachments/Screenshot_20260719_122519_Gallery-1784462806511-v7p7tn.jpeg" && echo "Downloaded OK" && python3 -c "from PIL import Image; img = Image.open('/tmp/workspace/nikah-cert/original.jpeg'); print('Size:', img.size, 'Mode:', img.mode)"
python3 << 'EOF' from PIL import Image import numpy as np img = Image.open('/tmp/workspace/nikah-cert/original.jpeg') arr = np.array(img) # Save a cropped region around the signature area to inspect # Based on 720x1600, signatures appear roughly in the lower third # Let's crop y: 850-1050, full width to see signature area sig_area = img.crop((0, 820, 720, 1050)) sig_area.save('/tmp/workspace/nikah-cert/sig_area.png') print("Sig area saved, size:", sig_area.size) EOF
python3 << 'EOF' from PIL import Image, ImageFilter, ImageEnhance import numpy as np img = Image.open('/tmp/workspace/nikah-cert/original.jpeg') w, h = img.size print(f"Original: {w}x{h}") # The certificate area (excluding black bars top and bottom) # Black bars: top ~200px, bottom ~280px # Certificate: roughly y=200 to y=1320 # Signature area analysis: # Image is 720x1600 # Signatures appear around y=860-920 (the actual handwriting lines) # Left signature (GROOM): approximately x=100-300, y=855-920 # Right signature (BRIDE): approximately x=400-620, y=855-920 # The underline/baseline for signatures: around y=920 # Let's be more precise - crop just the sig strips left_sig = img.crop((90, 845, 330, 930)) # groom signature area right_sig = img.crop((390, 845, 630, 930)) # bride signature area left_sig.save('/tmp/workspace/nikah-cert/left_sig.png') right_sig.save('/tmp/workspace/nikah-cert/right_sig.png') print("Left sig size:", left_sig.size) print("Right sig size:", right_sig.size) EOF
python3 << 'EOF' from PIL import Image, ImageEnhance, ImageFilter import numpy as np img = Image.open('/tmp/workspace/nikah-cert/original.jpeg') arr = np.array(img) # ---- STEP 1: Swap the signatures ---- # Groom signature region (left): x=90-330, y=845-930 # Bride signature region (right): x=390-630, y=845-930 # Both are 240x85 pixels - same size, easy swap left_region = arr[845:930, 90:330].copy() right_region = arr[845:930, 390:630].copy() arr[845:930, 90:330] = right_region arr[845:930, 390:630] = left_region swapped = Image.fromarray(arr) # ---- STEP 2: Upscale 3x with high quality ---- orig_w, orig_h = swapped.size # 720x1600 new_w = orig_w * 3 # 2160 new_h = orig_h * 3 # 4800 upscaled = swapped.resize((new_w, new_h), Image.LANCZOS) # ---- STEP 3: Enhance sharpness and contrast slightly ---- upscaled = ImageEnhance.Sharpness(upscaled).enhance(1.8) upscaled = ImageEnhance.Contrast(upscaled).enhance(1.1) upscaled = ImageEnhance.Color(upscaled).enhance(1.05) # Save as high-quality JPEG output_path = '/tmp/workspace/nikah-cert/certificate_final.jpg' upscaled.save(output_path, 'JPEG', quality=97, optimize=True) print(f"Saved: {output_path}") print(f"Final size: {upscaled.size}") import os size_kb = os.path.getsize(output_path) / 1024 print(f"File size: {size_kb:.1f} KB") EOF
certificate final
Image · JPG