Code Monkey home page Code Monkey logo

python-magickwand's Introduction

python-magickwand

Python bindings for the ImageMagick MagickWand API.

About

The MagickWand API is the recommended interface between the C programming language and the ImageMagick image processing libraries. This package provides bindings for the Python language.

Examples

flip

magick_wand = NewMagickWand()
MagickReadImage(magick_wand, 'rose.jpg')
if not MagickFlipImage(magick_wand):
    raise WandException(magick_wand)
MagickWriteImage(magick_wand, "result.jpg")

annotate

magick_wand = NewMagickWand()
MagickReadImage(magick_wand, 'rose.jpg')
drawing_wand=NewDrawingWand()
DrawSetFont(drawing_wand, "/usr/share/fonts/bitstream-vera/Vera.ttf")
DrawSetFontSize(drawing_wand, 20)
DrawSetGravity(drawing_wand, CenterGravity)
pixel_wand = NewPixelWand()
PixelSetColor(pixel_wand, "white")
DrawSetFillColor(drawing_wand, pixel_wand)
if not MagickAnnotateImage(magick_wand, drawing_wand, 0, 0, 0, "Rose") != 0:
    raise WandException(magick_wand)
MagickWriteImage(magick_wand, "result.jpg")

More samples are available in the samples directory.

Compatibility

API Versions

The MagickWand API is available in various versions:

ImageMagickMagickWandStatus
6.41not generated
6.52not generated
6.63supported
6.7.04supported
6.7.25supported

GraphicsMagick

The GraphicsMagick Wand API was forked from ImageMagick in August 2003. It lacks features that are available in newer versions and therefore, it is currently not supported here. Though, as GraphicsMagick focuses on a stable API, it would be nice to have support for it. Your contribution is highly welcome.

Alternatives

There are various other bindings and abstractions for ImageMagick, here is an onverview:

PythonMagick ------- 0.3 -- 0.4 -- 0.5 ---------------- 0.7 --------- 0.8 --------- 0.9.7
                               \
PythonMagickWand/Achim Domma     ---------------------- 0.2 --------- r107

PythonMagickWand/Ian Stevens                                   * ---- r42 -- r53
                                                                        \
python-magickwand/Benjamin Schweizer                                  2009 -------- 2011 - 2012
                                                                            \
python-magickwand/Oliver Berger                                              0.2

Wand                                                                                0.1 -- 0.1.9

                     2002   2003   2004   2005   2006   2007   2008   2009   2010   2011   2012

PythonMagick

PythonMagick is the oldest wrapper for the ImageMagick API. It is a C++ extension based on the Boost Library and thus, requires compilation on OS-level.

PythonMagickWand/Achim Domma

Achim Domma stated on PythonMagick that is is too hard to maintain and started a CDLL-based re-implementation of the MagickWand API. This version includes a custom API generator based on gccxml. Though, it was abandoned in 2008.

PythonMagickWand/Ian Stevens

Ian Stevens and Victor Ng started PythonMagickWand. PythonMagickWand aims to provide an object-oriented API that is structured to be more pythonic. Their implementation uses h2xml and xml2py for MagickWand API generation. It introduced the Image, Color and MagickWand classes that later influened the MagickFoo and Wand APIs.

There are two forks, one by Benjamin Schweizer named python-magickwand and a fork thereof by Oliver Berger named python-magickwand-0.2. The first is a direct predecessor of this source tree, the latter was abandoned in 2010.

MagickFoo

MagickFoo is an updated version of Ian Steven's PythonMagickWand API. It is included in python-magickwand.

Wand/Hong Minhee

Wand is a new CDLL-based abstraction by Hong Minhee. It was inspired by Ian Steven's PythonMagickWand API. As of 2012, the project is in active develop ment with regular github commits.

Authors

Todo

  • generate bindings for magickwand-1 and magickwand-2
  • re-enable win32 support

python-magickwand's People

Contributors

toofishes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-magickwand's Issues

Python doesn't find MagickWand

Hi, I'm configuring a RedHat 6.6, in my code I use MagickWand.

I've already installed ImageMagick by yum and the devel packs but when I try to run my code the following error apears:

Traceback (most recent call last):
  File "/data/www/los-back/logenerator_services/services/main.py", line 9, in <module>
    from file import file_upload_services
  File "/data/www/los-back/logenerator_services/services/file/file_upload_services.py", line 12, in <module>
    from wand.image import Image
  File "/data/env/lib/python2.7/site-packages/wand/image.py", line 20, in <module>
    from .api import MagickPixelPacket, libc, libmagick, library
  File "/data/env/lib/python2.7/site-packages/wand/api.py", line 1278, in <module>
    traceback.format_exc())
ImportError: MagickWand shared library not found or incompatible
Original exception was raised in:
Traceback (most recent call last):
  File "/data/env/lib/python2.7/site-packages/wand/api.py", line 739, in <module>
    ctypes.c_void_p] # PixelWand color
  File "/opt/rh/python27/root/usr/lib64/python2.7/ctypes/__init__.py", line 373, in __getattr__
    func = self.__getitem__(name)
  File "/opt/rh/python27/root/usr/lib64/python2.7/ctypes/__init__.py", line 378, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib64/libMagickWand.so.2: undefined symbol: DrawSetBorderColor

Result for yum install ImageMagick:

Loaded plugins: product-id, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Install Process
Package ImageMagick-6.5.4.7-7.el6_5.x86_64 already installed and latest version
Nothing to do

And for pip install MagickWand:

/<path_to_project>/env/bin/pip install MagickWand
Requirement already satisfied (use --upgrade to upgrade): MagickWand in /data/env/lib/python2.7/site-packages

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.