Looks like a cool Metroid-ish game I hadn't heard of, will check this one out.
e: The same dev did Odallus, that game was solid.
e: The same dev did Odallus, that game was solid.
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.
Show posts Menu
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)