gemini-logo-remover

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gemini Logo Remover

Gemini标识移除工具

Remove Gemini logos and watermarks from AI-generated images using inpainting.
使用修复技术移除AI生成图像中的Gemini标识和水印。

Setup

环境配置

bash
pip install opencv-python numpy pillow --break-system-packages
bash
pip install opencv-python numpy pillow --break-system-packages

Usage

使用方法

By Coordinates

通过坐标移除

python
import cv2
import numpy as np

def remove_region(input_path, output_path, x1, y1, x2, y2, radius=5):
    """Remove rectangular region using inpainting."""
    img = cv2.imread(input_path)
    h, w = img.shape[:2]
    
    mask = np.zeros((h, w), dtype=np.uint8)
    cv2.rectangle(mask, (x1, y1), (x2, y2), 255, -1)
    
    result = cv2.inpaint(img, mask, radius, cv2.INPAINT_TELEA)
    cv2.imwrite(output_path, result)
python
import cv2
import numpy as np

def remove_region(input_path, output_path, x1, y1, x2, y2, radius=5):
    """使用修复技术移除指定矩形区域。"""
    img = cv2.imread(input_path)
    h, w = img.shape[:2]
    
    mask = np.zeros((h, w), dtype=np.uint8)
    cv2.rectangle(mask, (x1, y1), (x2, y2), 255, -1)
    
    result = cv2.inpaint(img, mask, radius, cv2.INPAINT_TELEA)
    cv2.imwrite(output_path, result)

Example: remove region at coordinates

示例:移除指定坐标区域

remove_region('/mnt/user-data/uploads/img.png', '/mnt/user-data/outputs/clean.png', x1=700, y1=650, x2=800, y2=720)
undefined
remove_region('/mnt/user-data/uploads/img.png', '/mnt/user-data/outputs/clean.png', x1=700, y1=650, x2=800, y2=720)
undefined

By Corner

通过角落移除

python
def remove_corner_logo(input_path, output_path, corner='bottom_right', 
                       w_ratio=0.1, h_ratio=0.1, padding=10):
    """Remove logo from corner. corner: top_left, top_right, bottom_left, bottom_right"""
    img = cv2.imread(input_path)
    h, w = img.shape[:2]
    
    lw, lh = int(w * w_ratio), int(h * h_ratio)
    
    coords = {
        'bottom_right': (w - lw - padding, h - lh - padding, w - padding, h - padding),
        'bottom_left': (padding, h - lh - padding, lw + padding, h - padding),
        'top_right': (w - lw - padding, padding, w - padding, lh + padding),
        'top_left': (padding, padding, lw + padding, lh + padding)
    }
    x1, y1, x2, y2 = coords[corner]
    
    mask = np.zeros((h, w), dtype=np.uint8)
    cv2.rectangle(mask, (x1, y1), (x2, y2), 255, -1)
    
    result = cv2.inpaint(img, mask, 5, cv2.INPAINT_TELEA)
    cv2.imwrite(output_path, result)
python
def remove_corner_logo(input_path, output_path, corner='bottom_right', 
                       w_ratio=0.1, h_ratio=0.1, padding=10):
    """移除角落处的标识。corner可选值:top_left、top_right、bottom_left、bottom_right"""
    img = cv2.imread(input_path)
    h, w = img.shape[:2]
    
    lw, lh = int(w * w_ratio), int(h * h_ratio)
    
    coords = {
        'bottom_right': (w - lw - padding, h - lh - padding, w - padding, h - padding),
        'bottom_left': (padding, h - lh - padding, lw + padding, h - padding),
        'top_right': (w - lw - padding, padding, w - padding, lh + padding),
        'top_left': (padding, padding, lw + padding, lh + padding)
    }
    x1, y1, x2, y2 = coords[corner]
    
    mask = np.zeros((h, w), dtype=np.uint8)
    cv2.rectangle(mask, (x1, y1), (x2, y2), 255, -1)
    
    result = cv2.inpaint(img, mask, 5, cv2.INPAINT_TELEA)
    cv2.imwrite(output_path, result)

Example: remove bottom-right logo

示例:移除右下角的标识

remove_corner_logo('/mnt/user-data/uploads/img.png', '/mnt/user-data/outputs/no_logo.png', corner='bottom_right', w_ratio=0.08, h_ratio=0.08)
undefined
remove_corner_logo('/mnt/user-data/uploads/img.png', '/mnt/user-data/outputs/no_logo.png', corner='bottom_right', w_ratio=0.08, h_ratio=0.08)
undefined

Find Coordinates

查找坐标

python
img = cv2.imread(input_path)
h, w = img.shape[:2]
print(f"Size: {w}x{h}")
python
img = cv2.imread(input_path)
h, w = img.shape[:2]
print(f"尺寸: {w}x{h}")

Gemini 별 로고는 보통 이미지 우하단 모서리에서 약간 안쪽에 위치

Gemini的星形标识通常位于图像右下角稍内侧的位置

일반적인 좌표: x1=w-150, y1=h-100, x2=w-130, y2=h-55

常见坐标:x1=w-150, y1=h-100, x2=w-130, y2=h-55

정확한 위치는 이미지마다 다르므로 조정 필요

具体位置因图像而异,请根据实际情况调整

undefined
undefined

Output

输出

Always save to
/mnt/user-data/outputs/
and use
present_files
tool.
请始终将文件保存到
/mnt/user-data/outputs/
目录,并使用
present_files
工具。

Notes

注意事项

  • Inpainting works best for small areas with uniform backgrounds
  • Gemini logo is typically in bottom-right corner
  • Adjust coordinates/ratios based on actual logo position and size
  • 修复技术在背景均匀的小区域上效果最佳
  • Gemini标识通常位于右下角
  • 根据标识的实际位置和大小调整坐标/比例