python实现通过pil模块对图片格式进行转换的方法
作者:八大山人 时间:2021-03-06 01:55:54
本文实例讲述了python实现通过pil模块对图片格式进行转换的方法。分享给大家供大家参考。具体分析如下:
python的pil模块相当的智能,如果你需要对图片格式进行转换,比如jpg转转成tif,jpg转换成gif,png转换成jpg只需要在保存文件时指定正确的图片扩展名即可。
代码如下:
import Image
im = Image.open('test.jpg')
im.save('test.tiff') # or 'test.tif'
希望本文所述对大家的Python程序设计有所帮助。
标签:python,pil,图片,转换
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
按钮表状态还是表动作?
2009-03-23 18:21:00
![](https://img.aspxhome.com/file/UploadPic/20093/23/1-300x272-42s.jpg)
如何检测用户第一次访问我的网站并显示友好信息?
2009-11-25 20:33:00
asp 批量删除选中的多条记录
2011-03-29 10:33:00
![](https://img.aspxhome.com/file/UploadPic/20112/5/201125112326166.gif)
Python3实现从文件中读取指定行的方法
2021-01-06 04:18:17
Python统计python文件中代码,注释及空白对应的行数示例【测试可用】
2023-04-30 00:11:19
python求最大公约数和最小公倍数的简单方法
2022-08-31 22:05:45
python通过smpt发送邮件的方法
2021-06-18 02:50:59
mysql5在rhel5下乱码问题及解决方法
2010-12-03 16:26:00
![](https://img.aspxhome.com/file/UploadPic/201012/3/2010123165047481s.png)
Python爬虫简单运用爬取代理IP的实现
2021-08-25 23:26:42
![](https://img.aspxhome.com/file/2023/1/75201_0s.jpg)
如何在Python中引用其他模块
2022-09-26 23:30:21
![](https://img.aspxhome.com/file/2023/2/69492_0s.png)
python OpenCV图像金字塔
2021-11-03 04:00:48
![](https://img.aspxhome.com/file/2023/3/107483_0s.png)
关于matplotlib及相关cmap参数的取值方式
2023-06-26 15:19:18
![](https://img.aspxhome.com/file/2023/7/98807_0s.png)
Sublime Text 配置 Python 环境的问题及解决方案
2022-04-26 15:14:41
python3使用diagrams绘制架构图的步骤
2022-08-27 12:42:34
![](https://img.aspxhome.com/file/2023/8/87458_0s.png)
php下关于Cannot use a scalar value as an array的解决办法
2023-10-29 22:29:23
Python减肥小工具轻松帮你瘦
2021-07-20 09:54:41
![](https://img.aspxhome.com/file/2023/8/65508_0s.gif)
图片滤镜效果[IE Only]
2009-06-14 19:49:00
ASP自动解压RAR文件代码
2007-11-06 13:29:00
python使用turtle库与random库绘制雪花
2021-02-21 22:51:20
![](https://img.aspxhome.com/file/2023/4/72854_0s.jpg)
删除PHP数组中的重复元素的实现代码
2023-06-06 21:19:46
![](https://img.aspxhome.com/file/2023/0/55470_0s.png)