Last active
August 29, 2015 14:06
-
-
Save l3robot/31a369e71c91f35e25c9 to your computer and use it in GitHub Desktop.
A test of mine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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