1
Map Gab / Re: VGMaps.com now has over 50,000 maps!
« on: March 25, 2026, 07:33:39 am »
This made me realize I never submitted the ~80 maps I made for Tomb Raider 4-6. We'll hit 100k in no time
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
from PIL import Image
import numpy as np
def compare_images(image_path1, image_path2, output_path):
img1 = Image.open(image_path1)
img2 = Image.open(image_path2)
if img1.size != img2.size:
raise ValueError("Images must be the same size.")
# Convert images to numpy arrays
arr1 = np.array(img1)
arr2 = np.array(img2)
if arr1.shape != arr2.shape:
raise ValueError("Images must have the same number of channels.")
# Find where pixels are the same (set to black) and different (set to red)
diff = np.zeros_like(arr1)
mask = np.any(arr1 != arr2, axis=-1) # True where pixels differ
diff[..., 0] = mask * 255 # Red channel
diff[..., 1] = 0 # Green channel
diff[..., 2] = 0 # Blue channel
# Convert back to image
output_img = Image.fromarray(diff)
output_img.save(output_path)