问题描述
我正在尝试使用 Python 来调整图片大小.用我的相机,文件都是横向写的.
I am trying to use Python to resize picture. With my camera, files are all written is landscape way.
exif 信息处理一个标签以要求图像查看器以某种方式旋转.由于大多数浏览器不理解此信息,我想使用此 EXIF 信息旋转图像并保留所有其他 EXIF 信息.
The exif information handle a tag to ask the image viewer to rotate in a way or another. Since most of the browser doesn't understand this information, I want to rotate the image using this EXIF information and keeping every other EXIF information.
你知道我如何使用 Python 做到这一点吗?
Do you know how I can do that using Python ?
阅读 EXIF.py 源代码,我发现了类似的东西:
Reading the EXIF.py source code, I found something like that :
我如何使用这些信息和 PIL 来应用它?
How can I use this information and PIL to apply it ?
推荐答案
终于用上了pyexiv2,但在 GNU 以外的其他平台上安装有点棘手.
I finally used pyexiv2, but it is a bit tricky to install on other platforms than GNU.
如果您发现有什么可以改进的(除了它仍然适用于 Python 2.5),请告诉我.
If you see something that could be improved (except the fact that it is still for Python 2.5) then please let me know.
这篇关于如何使用 PIL 调整大小并将旋转 EXIF 信息应用于文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!