Skip to main content

Yet Another Python wrapper for GraphicsMagick

Project description

About

pgmagick is a yet another boost.python based wrapper for GraphicsMagick. (PythonMagick is dead?)

Install

install to:

$ pip install pgmagick

Require

Python2.5++, GraphicsMagick and Boost.Python.

package install on Ubuntu(test on Ubuntu10.04+):

$ apt-get install libgraphicsmagick++1-dev
$ apt-get install libboost-python1.40-dev

package install on Fedora:

$ yum install GraphicsMagick-c++-devel
$ yum install boost-devel

GraphicsMagick from source package:

$ ./configure --enable-shared=yes
$ make && make install

MacOSX

install reported on MacOSX, Thanks Simon Harrison.

http://simonharrison.info/talk/2011/01/17/pgmagick-on-mac-os/

Usage

scale example:

>>> from pgmagick import Image, FilterTypes
>>> im = Image('input.jpg')
>>> im.quality(100)
>>> im.filterType(FilterTypes.SincFilter)
>>> im.scale('100x100')
>>> im.sharpen(1.0)
>>> im.write('output.jpg')

composite example:

>>> from pgmagick import Image, CompositeOperator as co
>>> base = Image('base.png')
>>> layer = Image('layer_one.png')
>>> base.composite(layer, 100, 100, co.OverCompositeOp)
>>> im.write('output.png')

draw example:

>>> from pgmagick import Image, DrawableCircle, DrawableText, Geometry, Color
>>> im = Image(Geometry(300, 300), Color("yellow"))
>>> circle = DrawableCircle(100, 100, 20, 20)
>>> im.draw(circle)
>>> im.fontPointsize(65)
>>> text = DrawableText(30, 250, "Hello pgmagick")
>>> im.draw(text)
>>> im.write('hoge.png')

blob access:

>>> from pgmagick import Image, Blob, Geometry
>>> blob = Blob(open('filename.jpg').read())
>>> blob.update(open('filename2.jpg').read())
>>> img = Image(blob, Geometry(600, 480))
>>> img.scale('300x200')
>>> img.write('out.jpg')

more API detail… read to Magick++ API for GraphicsMagick document.

Python APIs(NOTICE!! this api is alpha version!!):

>>> from pgmagick.api import Image
>>> img = Image((300, 300), "gradient:#ffffff-#000000")
>>> img.scale(0.8)
>>> img.write('out.png')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pgmagick-0.3.5.tar.gz (32.1 kB view details)

Uploaded Source

File details

Details for the file pgmagick-0.3.5.tar.gz.

File metadata

  • Download URL: pgmagick-0.3.5.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pgmagick-0.3.5.tar.gz
Algorithm Hash digest
SHA256 c2ad929237f85d9cbdc968af3443be0e0713599e57a22d52b3179ee0e5ce4c21
MD5 b61b4a2db08e9c7cff54abf581baed5f
BLAKE2b-256 85b6b5a77f858e6cdb6865f61976fef21f7607a5a59fa8332c2be696aeb713b7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page