Created
April 20, 2012 18:23
-
-
Save artursapek/2430859 to your computer and use it in GitHub Desktop.
.jpeg distorting
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
import random | |
image = open('e.jpg', 'r') | |
lines = ''.join(image.readlines()) | |
image.close() | |
ran = int(random.random() * len(lines)) | |
for i in range(0, int(str(ran)[:1])/2): | |
ran = int(random.random() * len(lines)) | |
t = lines[ran:ran+ran*6] | |
f = lines[ran+400:ran+ran*6] | |
lines = lines.replace(t, f) | |
new = open('new.jpg', 'w') | |
new.write(lines) | |
new.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment