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 11# pythonchallenge
22Solve Problems in http://www.pythonchallenge.com
33
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+
412#### 15
513result: http://www.pythonchallenge.com/pc/return/mozart.html
614
You can’t perform that action at this time.
0 commit comments