Skip to content

Instantly share code, notes, and snippets.

@smolleyes
Created May 12, 2021 08:34
Show Gist options
  • Save smolleyes/2084cbc2068e8731988fddf57828aeb8 to your computer and use it in GitHub Desktop.
Save smolleyes/2084cbc2068e8731988fddf57828aeb8 to your computer and use it in GitHub Desktop.
from PIL import Image
img = Image.open("archive.extension")
pixels = img.load()
for i in range(img.size[0]):
for j in range(img.size[1]):
x,y,z = pixels[i,j][0],pixels[i,j][1],pixels[i,j][2]
x,y,z = abs(x-255), abs(y-255), abs(z-255)
pixels[i,j] = (x,y,z)
img.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment