• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    C++
  • License
    MIT License
  • Created about 11 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

About

PyPI Version Build status

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

use homebrew-pgmagick

$ 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

More Repositories

1

autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
Python
4,557
star
2

nude.py

Nudity detection with Python
Python
915
star
3

gocloc

A little fast cloc(Count Lines Of Code)
Go
703
star
4

python-hoedown

The Python binding for hoedown, a markdown parsing library.
HTML
50
star
5

gorst

Go implementation of reStructuredText
Go
33
star
6

pyrapidjson

Python binding for rapidjson
C++
26
star
7

poyonga

Python Groonga Client
Python
22
star
8

cargo-strict

avoid unwrap() method
Rust
18
star
9

kamasu

HTTP/HTTPS/HTTP2 Proxy for PHP Built-in Server, written in Rust
Rust
15
star
10

gruffy

Gruffy is Python implemetation of Gruff(Ruby's Graphing Library http://nubyonrails.com/pages/gruff)
Python
14
star
11

goroo

Yet Another Groonga Client for Go
Go
11
star
12

peg-rst

reStructuredText in C
C
11
star
13

otamapy

otama Python Interface
C
11
star
14

meow

Yet another markdown/reST preview server (based on moo)
JavaScript
9
star
15

zsh_completions

my zsh compeltion functions
Python
8
star
16

jc

command-line tool for jenkins-ci
Go
8
star
17

ftcat

markdown live previewer
Go
7
star
18

kuroko

Minimalistic Python Task Executor
Python
7
star
19

nem2-rs

NEM SDK for Rust
Rust
6
star
20

boom-rust

Rust implementation of boom
Rust
6
star
21

zoth

CLI Cache Tool
Rust
6
star
22

cargo-quickfix

Rust
5
star
23

fpath

fast Python's os.path module written in Rust
Python
5
star
24

pit-rs

pit in Rust
Rust
4
star
25

php-otama

PHP extension for otama
C
4
star
26

pyjsmn

Python extension for jsmn
C
4
star
27

fcsv

yet another Python csv module written in Rust
Python
4
star
28

cargobench-plot

Rust
3
star
29

python-pegmarkdown

Python binding for PEG-markdown
Python
3
star
30

backlog-rs

Nulab's Backlog API bindings for Rust
Rust
3
star
31

genzshcomp

Python
3
star
32

ray-tracing-in-one-weekend-in-rust

Rust
3
star
33

python-workq

Python Client for Workq (https://github.com/iamduo/workq)
Python
3
star
34

tamatebako

Rust
3
star
35

aiogrn

asyncio Groonga Client library
Python
2
star
36

pixiv-isucon2016-rust

Rust
2
star
37

pgstatprof

sampling profiler for PostgreSQL
Rust
2
star
38

nanairo

nanairo is a Go library that make the colorized output of terminal applications
Go
2
star
39

go-rlogger

rlogger with Go
Go
2
star
40

go-genzshcomp

generate zsh completion function from Go flag's help text
Go
2
star
41

hhatto

2
star
42

pywebp

Yet Another Python libwebp wrapper.
C
2
star
43

nuxt-vercel-boilerplate

Vue
2
star
44

sphinxcontrib-gruffygen

render Graph Extension for Sphinx
Python
2
star
45

fast-woothee-python

Rust
1
star
46

jubatus-rust-client

jubatus client in Rust
Rust
1
star
47

fastapi-snippets

FastAPI snippet
Python
1
star
48

rust-rlogger

rlogger with Rust
Rust
1
star
49

openweathermap-cli

CLI tool for OpenWeatherMap (written by Go)
Go
1
star
50

hhatto.github.io

HTML
1
star
51

slowfast

Two Python code compare using timeit module
Python
1
star
52

ss-ogp-image

TypeScript
1
star
53

rcoin

blockchain example written in Rust
Rust
1
star
54

zci

Zsh Completion function Installer
Python
1
star
55

go-scrapbox-parser

Go
1
star
56

libvmod-woothee

user agent parser for VMOD (Rust implementation)
M4
1
star
57

python-kcipher2

Python implementation of KCipher2 stream cipher
Python
1
star
58

goodc

goodcheck clone written in Rust
Rust
1
star
59

homebrew-pgmagick

brew for pgmagick
Ruby
1
star
60

homebrew-python-mecab

homebrew for python-mecab
Ruby
1
star
61

rust-ens

Rust ENS(Ethereum Name Service) interface
Rust
1
star
62

klip

Go parser for the Kindle's clippings.txt file
Go
1
star
63

go-coverhtml-ng

next-generatation go tool cover -html
1
star
64

homebrew-otama

homebrew for otama
Ruby
1
star
65

wwup-in-rust

[unofficial] example code for Working With Unix Processes in Rust
Rust
1
star