Skip to main content

Yet Another Python wrapper for GraphicsMagick

Project description

About

Build status

pgmagick is a yet another boost.python based wrapper for GraphicsMagick.

Installation

install to:

$ pip install pgmagick

Requirements

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

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

### Ubuntu11.10+ ###
$ apt-get install python-pgmagick

### 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

via homebrew-cask(homebrew-pgmagick) with Python2

use homebrew-pgmagick

$ brew tap hhatto/pgmagick
$ brew install pgmagick

via homebrew-cask(homebrew-pgmagick) with Python3

with –with-python3 option:

$ brew install pgmagick --with-python3

via homebrew and pip with Python3

on MacOSX 10.11.6:

$ brew install graphicsmagick
$ brew install boost-python --with-python3
$ pip install pgmagick

via homebrew and pip with Python2

update 2017.05.17 on MacOSX 10.11.6:

$ brew install graphicsmagick
$ brew install boost-python
$ pip install pgmagick

update 2014.05.12 on MacOSX 10.9.2 (add ARCHFLAGS):

$ brew install graphicsmagick
$ brew install boost --with-python
$ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pgmagick

Windows

Now, not official support. However, unofficial binary packages exists.

ImageMagick support

pgmagick is supported to ImageMagick library. (version:0.4+)

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

$ apt-get install libmagick++-dev

show library name and version:

>>> from pgmagick import gminfo
>>> gminfo.library
'GraphicsMagick'    # or 'ImageMagick'
>>> gminfo.version
'1.3.x'
>>>

Usage

scale example:

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

resize example:

>>> from pgmagick import Image
>>> im = Image('input.jpg')
>>> im.filterType(FilterTypes.SincFilter)
>>> im.resize('100x100')
>>> 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')

create animated-GIF:

from pgmagick import Image, ImageList, Geometry, Color

imgs = ImageList()
for color in ('red', 'blue', 'green', 'black', 'yellow'):
    imgs.append(Image(Geometry(200, 200), Color(color)))
imgs.animationDelayImages(100)
imgs.scaleImages(Geometry(100, 100))
imgs.writeImages('output.gif')

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.7.2.tar.gz (360.0 kB view details)

Uploaded Source

Built Distributions

pgmagick-0.7.2-cp36-cp36m-macosx_10_13_x86_64.whl (835.6 kB view details)

Uploaded CPython 3.6m macOS 10.13+ x86-64

pgmagick-0.7.2-cp36-cp36m-macosx_10_12_x86_64.whl (834.5 kB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

pgmagick-0.7.2-cp27-cp27m-macosx_10_13_x86_64.whl (836.7 kB view details)

Uploaded CPython 2.7m macOS 10.13+ x86-64

pgmagick-0.7.2-cp27-cp27m-macosx_10_12_x86_64.whl (836.1 kB view details)

Uploaded CPython 2.7m macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pgmagick-0.7.2.tar.gz
Algorithm Hash digest
SHA256 afb18093307853ed149b47a5750d46099c5983aa74e03a56bd2595e48413eaa5
MD5 5bd59111140f544858b9a6626e366d36
BLAKE2b-256 09b25e33ff0efd2f8dbcb3ee9371d0b4b9f8cc8f8c7ffb65d5ff25615e46d1a2

See more details on using hashes here.

File details

Details for the file pgmagick-0.7.2-cp36-cp36m-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pgmagick-0.7.2-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 76cd446d884986eaf1753b187683f13b3d7b472fb6f385ff786f9173108c20d2
MD5 a2a19442a0dac0a5fe3584b67f213402
BLAKE2b-256 f149a8e9a7362c8f88a7a469fe68690477c2a5e832e1386cf50e861d32de44ce

See more details on using hashes here.

File details

Details for the file pgmagick-0.7.2-cp36-cp36m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pgmagick-0.7.2-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0605e5fd21fd035b5fc9eaf2b8239fe9209c4a35dc3c87c467bd6d69d6431229
MD5 cc4c47d9acce2378c877c4a6985722c4
BLAKE2b-256 5fd78c569e315fa90a3b6b2d0ca56b3689b7480ec879d50dc978b13251ff2509

See more details on using hashes here.

File details

Details for the file pgmagick-0.7.2-cp27-cp27m-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pgmagick-0.7.2-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2473ab7f17757b558db7d7a71be492e9a32847a5a2ae917210a971fd2bc9dc7d
MD5 20053a8a6890ffeaf49db262f029a5fa
BLAKE2b-256 bcf7a23b647a8e87d278960422135b61267a43ea4a8ecee1ed7f479128ea28bc

See more details on using hashes here.

File details

Details for the file pgmagick-0.7.2-cp27-cp27m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pgmagick-0.7.2-cp27-cp27m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ad646ac3666a908b46fbdb9630ba1f291e561bc5973f0078871cf1379acacffc
MD5 e145d04bcc1ff552ce68f7d64a1d64e9
BLAKE2b-256 d46dca38b140277d3c6e62a38bf0e6016857ff7c42228ea10f22d8b07258c5d1

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