[英]Python PIL image saving
I'm new to PIL library and have some problem. 我是PIL库的新手,有一些问题。
base = Image.open('sam.bmp')
base.save(open('base.bmp', 'w'), 'BMP')
when I execute that block of code, saved image is distorted in some strange way. 当我执行那段代码时,保存的图像会以某种奇怪的方式扭曲。
opened and saved image: 打开并保存图像:
As you can see, I'm not doing any transformations with the image - only load and save. 正如您所看到的,我没有对图像进行任何转换 - 仅加载和保存。 Do you have any clue, why is it working that way? 你有什么线索,为什么这样工作?
正如Reti43所说,你只需要使用base.save('base.bmp')
This works : 这有效:
base = Image.open('sam.bmp')
base.save('base.bmp')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.