|
1 | 1 | importdownload_file
|
2 |
| -importread_bin_file |
3 | 2 |
|
4 | 3 | fromPILimportImage
|
| 4 | +fromPILimportImageSequence |
5 | 5 |
|
6 | 6 |
|
7 | 7 | defmain():
|
8 |
| -url="http://www.pythonchallenge.com/pc/hex/zigzag.jpg" |
9 |
| -file_path="zigzag/zigzag.jpg" |
| 8 | +file_name="zigzag.gif" |
| 9 | +url="http://www.pythonchallenge.com/pc/hex/{}".format(file_name) |
| 10 | +file_path="zigzag/{}".format(file_name) |
10 | 11 | user="butter"
|
11 | 12 | password="fly"
|
12 | 13 | # first_step(url, file_path, user, password)
|
13 |
| -# second_step(file_path) |
14 |
| -third_step(file_path) |
| 14 | +second_step(file_path) |
15 | 15 |
|
16 | 16 |
|
17 | 17 | deffirst_step(url,file_path,user,password):
|
18 | 18 | download_file.download_with_auth(url,file_path,user,password)
|
19 | 19 |
|
20 | 20 |
|
21 | 21 | defsecond_step(file_path):
|
22 |
| -ary=read_bin_file.read_bin_file(file_path) |
23 |
| -print(ary) |
24 |
| - |
25 |
| - |
26 |
| -defthird_step(file_path): |
27 | 22 | im=Image.open(file_path)
|
28 |
| -print(im) |
29 |
| -width,height=im.size |
| 23 | +forframeinImageSequence.Iterator(im): |
| 24 | +width,height=frame.size |
| 25 | +forxinrange(width): |
| 26 | +foryinrange(height): |
| 27 | +pixel=frame.getpixel((x,y)) |
| 28 | +print(pixel,end=" ") |
| 29 | +print(" ") |
30 | 30 |
|
31 | 31 |
|
32 | 32 | if__name__=="__main__":
|
|