Skip to content

Instantly share code, notes, and snippets.

@l3robot
Last active August 29, 2015 14:06
Show Gist options
  • Save l3robot/31a369e71c91f35e25c9 to your computer and use it in GitHub Desktop.
Save l3robot/31a369e71c91f35e25c9 to your computer and use it in GitHub Desktop.
A test of mine
from PIL import Image
def pair(a):
if a % 2 == 0:
return a
else:
return min(a+1,255)
im = Image.open("machiavel.jpg")
data = list(im.getdata())
h1 = list(im.histogram())
data3 = []
for i in data:
r = (pair(i[0]), pair(i[1]), pair(i[2]))
data3.append(r)
im.putdata(data3)
im.save("result" + ".jpg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment