attachment
attachment

Remove विधि कार्य विभाग Department Of Legal Affairs Ministry of Law & Justice logo and make clear image

Running Command

ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && ls -la /tmp/workspace/

Running Command

mkdir -p /tmp/workspace/logo-remove && cd /tmp/workspace/logo-remove && curl -s -o original.jpg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1000110153-1786244963516-sc734x.jpg" && echo "Downloaded" && python3 -c "from PIL import Image; img = Image.open('original.jpg'); print(img.size, img.mode)"

Running Command

cd /tmp/workspace/logo-remove && python3 << 'EOF' from PIL import Image, ImageFilter import numpy as np img = Image.open("original.jpg").convert("RGB") arr = np.array(img) # The logo area is in the top-left corner # Image is 1170x1463 # Logo + text spans approximately x: 0-430, y: 0-110 # Let's examine the colors around that region to match background # Sample the background color from right side of the logo area (same row, no logo) # and from just below the logo area # Background appears to be a light warm beige/cream color # Let's sample several points outside the logo area in the top region sample_points = [ (500, 10), (550, 10), (600, 10), (700, 10), (800, 10), (500, 50), (600, 50), (700, 50), (800, 50), (500, 80), (600, 80), (700, 80), ] colors = [arr[y, x] for x, y in sample_points] print("Sample colors around logo area:", colors[:5]) # Check average background color in top-right area (no logo there) top_right = arr[0:120, 450:1170] avg_color = top_right.mean(axis=(0,1)) print("Average color top-right:", avg_color) # The logo region to remove: roughly x=0..420, y=0..110 # We need to fill this with background matching color # Since the background has some texture/pattern, let's do a smarter fill: # Copy the texture pattern from the right side of the same rows # Strategy: for each row in logo region, fill with pixels from the right side # (mirrored/tiled from a non-logo area at the same y level) logo_x_end = 440 # end of logo area horizontally logo_y_end = 115 # end of logo area vertically # For each pixel in the logo region, replace with # corresponding pixel from right side (offset by logo_x_end) # or just use a clean patch from similar background area # Let's look at what's at same y, but x > logo_x_end patch = arr[0:logo_y_end, logo_x_end:logo_x_end*2] print("Patch shape:", patch.shape) print("Patch avg color:", patch.mean(axis=(0,1))) EOF

Running Command

cd /tmp/workspace/logo-remove && python3 << 'EOF' from PIL import Image, ImageFilter import numpy as np img = Image.open("original.jpg").convert("RGB") arr = np.array(img, dtype=np.float32) logo_x_end = 440 logo_y_end = 115 # Strategy: replace the logo region with the texture from the right side # The background has subtle texture/pattern, so we tile from same-row pixels # For each row in logo area, use pixels from x=logo_x_end onwards (tiled) for y in range(logo_y_end): for x in range(logo_x_end): # Map to source pixel on right side, same y row src_x = logo_x_end + (x % logo_x_end) arr[y, x] = arr[y, src_x] # Apply slight blur to blend the seam at x=logo_x_end boundary result = Image.fromarray(arr.astype(np.uint8)) # Blur just a thin vertical strip at the seam seam_region = result.crop((logo_x_end - 8, 0, logo_x_end + 8, logo_y_end)) seam_blurred = seam_region.filter(ImageFilter.GaussianBlur(radius=3)) result.paste(seam_blurred, (logo_x_end - 8, 0)) # Also blend at bottom edge (y=logo_y_end) bottom_seam = result.crop((0, logo_y_end - 8, logo_x_end, logo_y_end + 8)) bottom_blurred = bottom_seam.filter(ImageFilter.GaussianBlur(radius=2)) result.paste(bottom_blurred, (0, logo_y_end - 8)) result.save("cleaned.jpg", quality=95) print("Saved cleaned.jpg") # Verify img2 = Image.open("cleaned.jpg") print("Output size:", img2.size) EOF

Loading Image
Running Command

cd /tmp/workspace/logo-remove && python3 << 'EOF' # Let's also do a higher quality upscale (sharpen) of the final image from PIL import Image, ImageEnhance, ImageFilter import numpy as np img = Image.open("cleaned.jpg").convert("RGB") # Enhance sharpness slightly for a cleaner look enhancer = ImageEnhance.Sharpness(img) img_sharp = enhancer.enhance(1.3) # Slight contrast boost enhancer2 = ImageEnhance.Contrast(img_sharp) img_final = enhancer2.enhance(1.05) img_final.save("cleaned_sharp.png", format="PNG") print("Saved PNG version:", img_final.size) EOF

The logo has been removed and the image has been cleaned up. Here are your download links:
JPG version (high quality, smaller file):

cleaned

Image · JPG

PNG version (lossless + sharpened):

cleaned sharp

Image · PNG

What was done:
  • Detected the logo area (top-left, approx 440×115 px region containing the Ashoka emblem, Hindi text "विधि कार्य विभाग", "Department Of Legal Affairs", and "Ministry of Law & Justice")
  • Replaced that region with matching background texture tiled from the same rows on the right side
  • Blended the seam edges with a slight Gaussian blur for a smooth, natural look
  • Applied a mild sharpness and contrast boost for a cleaner, crisper final image

Remove satyamev jayate too

Running Command

cd /tmp/workspace/logo-remove && python3 << 'EOF' from PIL import Image import numpy as np img = Image.open("original.jpg").convert("RGB") arr = np.array(img) # Let's check where "satyamev jayate" text is # It appears below the Ashoka emblem, in small text # From the image, it looks like it's around y=105-125, x=0-120 (small text under the emblem) # The main logo block ended at y~115, but satyamev jayate might be just below that # Let's look at a wider region - the entire top-left area including satyamev jayate # Satyamev jayate is typically below the Ashoka emblem in small text # Looking at image: emblem ~x:0-80, y:0-100; text block x:85-430, y:0-110 # satyamev jayate appears to be at bottom of emblem: x:0-90, y:100-125 # Print a patch to understand print("Image size:", arr.shape) # satyamev jayate is the small text under the lion capital # it appears at approximately y: 100-130, x: 0-100 print("Region y=100-130, x=0-100 sample:", arr[105:120, 5:30].mean(axis=(0,1))) EOF

Running Command

cd /tmp/workspace/logo-remove && python3 << 'EOF' from PIL import Image, ImageFilter import numpy as np img = Image.open("original.jpg").convert("RGB") arr = np.array(img, dtype=np.float32) # Extended logo region: # - Main logo block (emblem + text): x=0..440, y=0..115 # - "satyamev jayate" small text is just below the emblem: x=0..100, y=105..130 # Let's extend the removal area to cover satyamev jayate fully # Full removal zone: x=0..440, y=0..130 (covers everything) logo_x_end = 440 logo_y_end = 130 # extended to cover satyamev jayate # Replace with tiled texture from right side of same rows for y in range(logo_y_end): for x in range(logo_x_end): src_x = logo_x_end + (x % logo_x_end) arr[y, x] = arr[y, src_x] result = Image.fromarray(arr.astype(np.uint8)) # Blend seam at right edge (x = logo_x_end) seam_region = result.crop((logo_x_end - 10, 0, logo_x_end + 10, logo_y_end)) seam_blurred = seam_region.filter(ImageFilter.GaussianBlur(radius=3)) result.paste(seam_blurred, (logo_x_end - 10, 0)) # Blend seam at bottom edge (y = logo_y_end) bottom_seam = result.crop((0, logo_y_end - 10, logo_x_end, logo_y_end + 10)) bottom_blurred = bottom_seam.filter(ImageFilter.GaussianBlur(radius=2)) result.paste(bottom_blurred, (0, logo_y_end - 10)) # Sharpen slightly from PIL import ImageEnhance enhancer = ImageEnhance.Sharpness(result) result = enhancer.enhance(1.3) enhancer2 = ImageEnhance.Contrast(result) result = enhancer2.enhance(1.05) result.save("cleaned_v2.jpg", quality=95) result.save("cleaned_v2.png", format="PNG") print("Done. Size:", result.size) EOF

Done! The "सत्यमेव जयते" (Satyamev Jayate) text has also been removed along with the full logo block. The entire top-left corner is now clean background.
JPG version:

cleaned v2

Image · JPG

PNG version (lossless):

cleaned v2

Image · PNG

This is a shared conversation. Sign in to Orris to start your own chat.