About
pgmagick is a yet another boost.python based wrapper for GraphicsMagick .
Installation
install to:
$ pip install pgmagick
Requirements
Python3.5++ (or Python2.7), GraphicsMagick and Boost.Python.
package install on Debian Buster:
$ apt-get install g++ libgraphicsmagick++1-dev libboost-python-dev
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 Python3
$ brew tap hhatto/pgmagick $ brew install pgmagick
via homebrew-cask(homebrew-pgmagick) with Python3
via homebrew and pip with Python3
on MacOSX (10.13.5~10.15.x):
$ brew install python $ brew install graphicsmagick $ brew install boost-python3 $ 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')
Links
Metadata
Release files for pgmagick 0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pgmagick-0.8.tar.gz | 1.3 MB | Without provenance | Details |
Release files / pgmagick-0.8.tar.gz
| Download URL | pgmagick-0.8.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfc50991e2f0b8fc7c6ab59598f3e59abf14406c84335e82394ad649e857f094
|
|
BLAKE2b-256 checksum How to use checksums |
5f36ef92ade3d99d8eae5126e2a47c55ab19d607f36211fb726cef59d64d06f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for pgmagick 0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.