import glob from PIL import Image def analyze_edges(img_path): img = Image.open(img_path).convert('RGB') w, h = img.size pixels = img.load() top = [pixels[x, 0] for x in range(w)] bottom = [pixels[x, h-1] for x in range(w)] left = [pixels[0, y] for y in range(h)] right = [pixels[w-1, y] for y in range(h)] print(f"File: {img_path}") print(f"Top edge unique colors: {set(top)}") print(f"Bottom edge unique colors: {set(bottom)}") print(f"Left edge unique colors: {set(left)}") print(f"Right edge unique colors: {set(right)}") print("---------------------------------") for f in ['BMP_1_GRASS_1.png', 'BMP_1_GRASS_2.png', 'BMP_1_N.png']: analyze_edges(f'/tmp/orig_rat/{f}')