File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 11import download_file
2- import read_bin_file
32
43from PIL import Image
4+ from PIL import ImageSequence
55
66
77def main ():
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 )
1011 user = "butter"
1112 password = "fly"
1213 # first_step(url, file_path, user, password)
13- # second_step(file_path)
14- third_step (file_path )
14+ second_step (file_path )
1515
1616
1717def first_step (url , file_path , user , password ):
1818 download_file .download_with_auth (url , file_path , user , password )
1919
2020
2121def second_step (file_path ):
22- ary = read_bin_file .read_bin_file (file_path )
23- print (ary )
24-
25-
26- def third_step (file_path ):
2722 im = Image .open (file_path )
28- print (im )
29- width , height = im .size
23+ for frame in ImageSequence .Iterator (im ):
24+ width , height = frame .size
25+ for x in range (width ):
26+ for y in range (height ):
27+ pixel = frame .getpixel ((x , y ))
28+ print (pixel , end = " " )
29+ print (" " )
3030
3131
3232if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments