from PIL import Image, ImageFilter, ImageOps
Load the image from the URL
img_url = "https://svs.gsfc.nasa.gov/vis/a000000/a004700/a004720/lroc_color_poles_1k.jpg" img = Image.open(requests.get(img_url, stream=True).raw)
Convert the image to grayscale
gray_img = ImageOps.grayscale(img)
Apply a high-pass filter to emphasize the edges
filtered_img = gray_img.filter(ImageFilter.FIND_EDGES)
Invert the image to get a negative
inverted_img = ImageOps.invert(filtered_img)
Apply a color mapping to the negative image
color_map = [(0, 0, 0), (255, 255, 255), (142, 35, 35), (255, 192, 203)] arcane_img = inverted_img.convert('P', palette=Image.ADAPTIVE, colors=4) arcane_img.putpalette(color_map)
Display the resulting image
arcane_img.show()