在 Python 中为基本图像文件 I/O 和处理寻找 PIL 的更好替代方案?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/715030/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Looking for a better alternative to PIL for basic image file I/O and processing in Python?
提问by VogonPoet
Are there better alternatives to PIL (Python Imaging Library) for basic image file I/O and processing in Python?
对于基本图像文件 I/O 和 Python 处理,是否有更好的 PIL(Python 成像库)替代方案?
回答by Munhitsu
Try Pillow: http://pypi.python.org/pypi/Pillow
试试枕头:http: //pypi.python.org/pypi/Pillow
It's a fork of PIL but maintained by Plone community. Which is great as it is being maintained (in comparison to it's predecessor) and it is backward compatible with PIL. Existing code will work out of the box with Pillow.
它是 PIL 的一个分支,但由 Plone 社区维护。这很棒,因为它正在维护(与它的前身相比)并且它与 PIL 向后兼容。现有代码将与 Pillow 一起开箱即用。
They mostly focus on packaging issues and AFAIK this was the biggest pain with PIL.
他们主要关注包装问题,AFAIK 这是 PIL 最大的痛点。
Good luck!
祝你好运!
回答by Dusty Phillips
If by 'better' you mean "faster" or "less memory intensive" or (the big one in my experiments) "able to handle much larger images," you might be able to use the Python interface to VIPS:
如果“更好”的意思是“更快”或“更少的内存密集型”或(我实验中的大问题)“能够处理更大的图像”,那么您可能可以使用 VIPS 的 Python 接口:
http://www.vips.ecs.soton.ac.uk/index.php?title=Python
http://www.vips.ecs.soton.ac.uk/index.php?title=Python
However, if 'better' means "well-tested in Python," or "Windows-friendly," VIPS won't fit the bill.
但是,如果“更好”的意思是“在 Python 中经过良好测试”或“Windows 友好”,那么 VIPS 将不符合要求。
回答by Keith Gaughan
Not really. PIL is pretty much what everybody uses. I've never had any difficulties with it myself. However, if you really don't like it, you could check out PythonMagick or PythonMagickWand, which are wrappers around ImageMagick, which may be more to your taste.
并不真地。PIL几乎是每个人都使用的。我自己从来没有遇到过任何困难。但是,如果你真的不喜欢它,你可以查看 PythonMagick 或 PythonMagickWand,它们是 ImageMagick 的包装器,它们可能更合你的口味。
回答by sbbs
I'd suggest Python Wand, which is a ctypes-based simple ImageMagick binding for Python.
我建议使用Python Wand,这是一个基于 ctypes 的简单ImageMagick绑定 Python。
回答by Joe Shaw
Wandis a great library for simple manipulation like image file format conversion, cropping, resizing, watermarking and basic compositing. It's build on top of ImageMagick's MagicWand C library, but exposes a beautiful Pythonic API.
Wand是一个很棒的库,用于简单操作,如图像文件格式转换、裁剪、调整大小、水印和基本合成。它建立在 ImageMagick 的 MagicWand C 库之上,但公开了一个漂亮的 Pythonic API。
回答by Andrea Spadaccini
I don't know your task, but OpenCVhas Python bindings, you could read the docs and see if it is suited to what you have to do.