import os from PIL import Image, ImageDraw BASE_IMAGE = r"d:\dsWork\aiData\Output\Screenshot_20260116_223152.jpg" OUTPUT_DIR = r"d:\dsWork\aiData\Output\debug_right_ad_candidates" def generate_vertical_candidates(): if not os.path.exists(BASE_IMAGE): raise FileNotFoundError(BASE_IMAGE) os.makedirs(OUTPUT_DIR, exist_ok=True) img = Image.open(BASE_IMAGE).convert("RGB") w, h = img.size base_x = int(w * 0.88) ratios = [0.60, 0.64, 0.68, 0.70, 0.72, 0.74, 0.76, 0.78, 0.80, 0.83, 0.84] radius = max(6, int(h * 0.012)) for r in ratios: y = int(h * r) y = max(radius, min(h - radius - 1, y)) img2 = img.copy() draw = ImageDraw.Draw(img2) draw.ellipse((base_x - radius, y - radius, base_x + radius, y + radius), outline="cyan", width=3) name = f"right_candidate_y_{int(r*100)}.jpg" path = os.path.join(OUTPUT_DIR, name) img2.save(path) print(path) if __name__ == "__main__": generate_vertical_candidates()