效果如下:
(从左至右依次为:原图,锐化,美白)
4、生成gif:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import PIL.Image as Image def get_gif(pics_dir,n,t = 300 ): imgs = [] for i in range (n): pic_name = '{}/{}.jpg' . format (pics_dir,i) temp = Image. open (pic_name) imgs.append(temp) save_name = '{}.gif' . format (pics_dir) imgs[ 0 ].save(save_name, save_all = True , append_images = imgs, duration = t) return save_name if __name__ = = '__main__' : pics_dir = 'D:\\我爱学习\\python3\\photos\\crazy2' save_name = get_gif(pics_dir, 32 , 300 ) print ( '制作完成。所属文件:{}' . format (save_name)) |
效果如下: