File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ from PIL import Image
2
+
3
+
4
+ def straighten (source ):
5
+ target = source .copy ()
6
+ for y in range (source .size [1 ]):
7
+ line = [source .getpixel ((x , y )) for x in range (source .size [0 ])]
8
+ pink = line .index (195 )
9
+ line = line [pink :] + line [:pink ]
10
+ for x , pixel in enumerate (line ):
11
+ target .putpixel ((x , y ), pixel )
12
+ return target
13
+
14
+
15
+ out = straighten (Image .open ("mozart/mozart.gif" ))
16
+ out .save ("mozart/out.gif" )
Original file line number Diff line number Diff line change 1
1
# pythonchallenge
2
2
Solve Problems in http://www.pythonchallenge.com
3
3
4
+ #### 16
5
+ result: http://www.pythonchallenge.com/pc/return/romance.html
6
+ ``` python
7
+ from PIL import Image
8
+ ```
9
+ - this gif is a P mode picture which use one 8 bit number to declare a color
10
+ - straight is a way to handle these pixels
11
+
4
12
#### 15
5
13
result: http://www.pythonchallenge.com/pc/return/mozart.html
6
14
You can’t perform that action at this time.
0 commit comments