我可以使用Python访问ImageMagick API吗? [英] Can I access ImageMagick API with Python?
问题描述
我需要使用 ImageMagick ,因为PIL没有拥有我正在寻找的图像功能。但是,我想使用Python。
I need to use ImageMagick as PIL does not have the amount of image functionality available that I am looking for. However, I am wanting to use Python.
自2009年以来,python绑定(PythonMagick)尚未更新。我唯一能找到的是 os.system
调用使用命令行界面,但这看起来很笨拙。
The python bindings (PythonMagick) have not been updated since 2009. The only thing I have been able to find is os.system
calls to use the command line interface but this seems clunky.
有没有办法直接使用API访问API ctypes
和某种转换?
作为最后的手段,还有其他任何图书馆都有大量的图像编辑工具,比如ImageMagick,我已查看了吗?
Is there any way to access the API directly using ctypes
and conversions of some sort?
As a last resort is there any other library out there that has the extensive amount of image editing tools like ImageMagick that I have looked over?
推荐答案
我建议使用魔杖(解释如下) 。
I would recommend using Wand (explanations follows).
我正在寻找与ImageMagick库的正确绑定,这将:
I was looking for proper binding to ImageMagick library, that would:
- 工作错误/无问题
- 定期维护和更新
- 允许好的目标Python
但实际上python API(绑定)有太多不同的(大多数已停产)版本。在阅读了Benjamin Schweizer的精彩历史概述后,它已经变得清晰(另见他的 github wiki ):
But indeed python API (binding) has too many different (mostly discontinued) versions. After reading a nice historical overview by Benjamin Schweizer it has all become clear (also see his github wiki):
- GraphicsMagick
- PythonMagick - 首次实施
- PythonMagickWand / Achim Domma - 第一个魔杖 - 一个CDLL实现
- PythonMagickWand / Ian Stevens
- MagickFoo - 包含在python-magickwand
- Wand / Hong Minhee - 最新项目
- GraphicsMagick
- PythonMagick - first implementation
- PythonMagickWand/Achim Domma - first Wand - a CDLL implementation
- PythonMagickWand/Ian Stevens
- MagickFoo - included in python-magickwand
- Wand/Hong Minhee - the latest project
现在Wand只是一个(简化)ImageMagick的C API.. API是C编程语言和ImageMagick图像处理库之间的推荐接口。与MagickCore C API不同,MagickWand仅使用一些不透明类型。访问器可用于设置或变得重要魔杖属性。 (查看项目主页)
Now Wand is just a (reduced) C API to the ImageMagick ".. API is the recommended interface between the C programming language and the ImageMagick image processing libraries. Unlike the MagickCore C API, MagickWand uses only a few opaque types. Accessors are available to set or get important wand properties." (See project homepage)
因此,它已经是一个易于维护的简化界面。
So it is already a simplified interface that is easer to maintain.
这篇关于我可以使用Python访问ImageMagick API吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!