如何使用Python读取图像文件? [英] How do I read an image file using Python?
本文介绍了如何使用Python读取图像文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何阅读图像文件并使用Python对其进行解码?
How do I read an image file and decode it using Python?
推荐答案
阅读一词含糊不清,但这是一个使用Image类读取jpeg文件的示例,并打印有关它的信息。
The word "read" is vague, but here is an example which reads a jpeg file using the Image class, and prints information about it.
from PIL import Image
jpgfile = Image.open("picture.jpg")
print(jpgfile.bits, jpgfile.size, jpgfile.format)
这篇关于如何使用Python读取图像文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文