[Python-modules-commits] [python-pgmagick] 01/08: New upstream version 0.7.2

Takaki Taniguchi takaki at moszumanska.debian.org
Sat Feb 3 15:33:55 UTC 2018


This is an automated email from the git hooks/post-receive script.

takaki pushed a commit to branch master
in repository python-pgmagick.

commit aae187b4920d0eae4b10eae40bb3f1475913e74b
Author: TANIGUCHI Takaki <takaki at asis.media-as.org>
Date:   Sat Feb 3 22:41:24 2018 +0900

    New upstream version 0.7.2
---
 MANIFEST.in                      |   2 +
 PKG-INFO                         |  56 +++++---
 README.rst                       |  53 +++++---
 example/X.jpg                    | Bin 0 -> 305537 bytes
 example/bezier.py                |  12 ++
 example/blob.py                  |   8 ++
 example/docs/japanese-text.py    |   8 ++
 example/draw.py                  |  13 ++
 example/drawablelist.py          |  32 +++++
 example/example.png              | Bin 0 -> 7831 bytes
 example/gm.sh                    |   6 +
 example/gradient.py              |   7 +
 example/gravity.py               |  44 +++++++
 example/im.sh                    |   6 +
 example/image_from_storage.py    |   5 +
 example/imagelist.py             |  14 ++
 example/pgmagick_prof.py         |  32 +++++
 example/pixels.py                |  15 +++
 example/profile.sh               |  38 ++++++
 example/pythonmagick_prof.py     |  28 ++++
 example/resize.py                |   5 +
 example/writeimages_with_blob.py |  13 ++
 pgmagick.egg-info/PKG-INFO       |  56 +++++---
 pgmagick.egg-info/SOURCES.txt    |  23 ++++
 pgmagick/_version.py             |   2 +-
 pgmagick/api.py                  |   8 +-
 setup.cfg                        |   1 -
 setup.py                         |  61 ++++++---
 src/Makefile                     |   4 +-
 src/_ArrayProxy.h                |  57 ++++++++
 src/_Image.cpp                   |  62 +++++++--
 src/_Pixels.cpp                  |  24 +++-
 src/_Pixels.h                    |  28 ++++
 test/test_pgmagick_api.py        | 272 +++++++++++++++++++++++----------------
 test/test_pgmagick_image.py      |  77 ++++++++++-
 test/test_pgmagick_libinfo.py    |   6 +-
 36 files changed, 860 insertions(+), 218 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index f870b3c..8c259f3 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,3 +2,5 @@ include Makefile
 include src/Makefile
 include LICENSE
 include README.rst
+include src/*.h
+recursive-include example *
diff --git a/PKG-INFO b/PKG-INFO
index c0ea39e..4347c89 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: pgmagick
-Version: 0.6.5
+Version: 0.7.2
 Summary: Yet Another Python wrapper for GraphicsMagick
 Home-page: https://github.com/hhatto/pgmagick
 Author: Hideo Hattori
 Author-email: hhatto.jp at gmail.com
 License: MIT
+Description-Content-Type: UNKNOWN
 Description: About
         =====
         
@@ -49,8 +50,8 @@ Description: About
         MacOSX
         ------
         
-        via homebrew-cask(homebrew-pgmagick)
-        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        via homebrew-cask(homebrew-pgmagick) with Python2
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         use `homebrew-pgmagick`_ ::
         
             $ brew tap hhatto/pgmagick
@@ -58,28 +59,36 @@ Description: About
         
         .. _`homebrew-pgmagick`: https://github.com/hhatto/homebrew-pgmagick
         
-        via homebrew and pip
-        ~~~~~~~~~~~~~~~~~~~~
-        *update 2014.05.12*
-        on MacOSX 10.9.2 (add ARCHFLAGS)::
+        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 --with-python
-            $ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pgmagick
+            $ brew install boost-python --with-python3
+            $ pip install pgmagick
         
-        *update 2013.08.31*
-        with Homebrew_ ::
+        via homebrew and pip with Python2
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        *update 2017.05.17*
+        on MacOSX 10.11.6::
         
-            $ brew install graphicsmagick     # or imagemagick
-            $ brew install boost --with-thread-unsafe --build-from-source
+            $ brew install graphicsmagick
+            $ brew install boost-python
             $ pip install pgmagick
         
-        install reported on MacOSX, Thanks Rohan Singh and Simon Harrison.
+        *update 2014.05.12*
+        on MacOSX 10.9.2 (add ARCHFLAGS)::
         
-        - http://rohanradio.com/blog/2011/12/02/installing-pgmagick-on-os-x/
-        - http://simonharrison.info/talk/2011/01/17/pgmagick-on-mac-os/ (old)
+            $ brew install graphicsmagick
+            $ brew install boost --with-python
+            $ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pgmagick
         
-        .. _Homebrew: http://brew.sh/
         
         Windows
         -------
@@ -110,14 +119,21 @@ Description: About
         
         scale example::
         
-            >>> from pgmagick import Image, FilterTypes
+            >>> from pgmagick import Image
             >>> im = Image('input.jpg')
             >>> im.quality(100)
-            >>> im.filterType(FilterTypes.SincFilter)
             >>> 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
@@ -174,12 +190,10 @@ Description: About
         * PyPI_
         * `Project Page`_
         * `Project Page (Old)`_
-        * `CI(Jenkins)`_
         
         .. _PyPI: http://pypi.python.org/pypi/pgmagick/
         .. _`Project Page`: https://github.com/hhatto/pgmagick/
         .. _`Project Page (Old)`: https://bitbucket.org/hhatto/pgmagick/
-        .. _`CI(Jenkins)`: http://jenkins.hexacosa.net/job/pgmagick/
         
 Keywords: GraphicsMagick ImageMagick graphics boost image
 Platform: UNKNOWN
diff --git a/README.rst b/README.rst
index 8132d07..cf361b1 100644
--- a/README.rst
+++ b/README.rst
@@ -41,8 +41,8 @@ GraphicsMagick from source package::
 MacOSX
 ------
 
-via homebrew-cask(homebrew-pgmagick)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+via homebrew-cask(homebrew-pgmagick) with Python2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 use `homebrew-pgmagick`_ ::
 
     $ brew tap hhatto/pgmagick
@@ -50,28 +50,36 @@ use `homebrew-pgmagick`_ ::
 
 .. _`homebrew-pgmagick`: https://github.com/hhatto/homebrew-pgmagick
 
-via homebrew and pip
-~~~~~~~~~~~~~~~~~~~~
-*update 2014.05.12*
-on MacOSX 10.9.2 (add ARCHFLAGS)::
+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 --with-python
-    $ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pgmagick
+    $ brew install boost-python --with-python3
+    $ pip install pgmagick
 
-*update 2013.08.31*
-with Homebrew_ ::
+via homebrew and pip with Python2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+*update 2017.05.17*
+on MacOSX 10.11.6::
 
-    $ brew install graphicsmagick     # or imagemagick
-    $ brew install boost --with-thread-unsafe --build-from-source
+    $ brew install graphicsmagick
+    $ brew install boost-python
     $ pip install pgmagick
 
-install reported on MacOSX, Thanks Rohan Singh and Simon Harrison.
+*update 2014.05.12*
+on MacOSX 10.9.2 (add ARCHFLAGS)::
 
-- http://rohanradio.com/blog/2011/12/02/installing-pgmagick-on-os-x/
-- http://simonharrison.info/talk/2011/01/17/pgmagick-on-mac-os/ (old)
+    $ brew install graphicsmagick
+    $ brew install boost --with-python
+    $ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pgmagick
 
-.. _Homebrew: http://brew.sh/
 
 Windows
 -------
@@ -102,14 +110,21 @@ Usage
 
 scale example::
 
-    >>> from pgmagick import Image, FilterTypes
+    >>> from pgmagick import Image
     >>> im = Image('input.jpg')
     >>> im.quality(100)
-    >>> im.filterType(FilterTypes.SincFilter)
     >>> 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
@@ -166,9 +181,7 @@ Links
 * PyPI_
 * `Project Page`_
 * `Project Page (Old)`_
-* `CI(Jenkins)`_
 
 .. _PyPI: http://pypi.python.org/pypi/pgmagick/
 .. _`Project Page`: https://github.com/hhatto/pgmagick/
 .. _`Project Page (Old)`: https://bitbucket.org/hhatto/pgmagick/
-.. _`CI(Jenkins)`: http://jenkins.hexacosa.net/job/pgmagick/
diff --git a/example/X.jpg b/example/X.jpg
new file mode 100644
index 0000000..996cf9d
Binary files /dev/null and b/example/X.jpg differ
diff --git a/example/bezier.py b/example/bezier.py
new file mode 100644
index 0000000..951985c
--- /dev/null
+++ b/example/bezier.py
@@ -0,0 +1,12 @@
+from pgmagick import Image, Geometry, Color, Coordinate, CoordinateList, \
+                     DrawableBezier
+
+im = Image(Geometry(300, 200), Color("white"))
+cdl = CoordinateList()
+cdl.append(Coordinate(20, 20))
+cdl.append(Coordinate(100, 50))
+cdl.append(Coordinate(50, 100))
+cdl.append(Coordinate(160, 160))
+db = DrawableBezier(cdl)
+im.draw(db)
+im.display()
diff --git a/example/blob.py b/example/blob.py
new file mode 100644
index 0000000..7cc84ad
--- /dev/null
+++ b/example/blob.py
@@ -0,0 +1,8 @@
+from pgmagick import Blob, Image, Color, Geometry
+
+blob = Blob(open('example.png').read())
+#print dir(blob)
+#print len(blob.data)
+#print blob.length()
+img = Image(blob)
+img.write('from_blob_to_image.png')
diff --git a/example/docs/japanese-text.py b/example/docs/japanese-text.py
new file mode 100644
index 0000000..45825ef
--- /dev/null
+++ b/example/docs/japanese-text.py
@@ -0,0 +1,8 @@
+# coding: utf-8
+from pgmagick.api import Image
+
+img = Image((300, 200))
+img.font("/etc/alternatives/fonts-japanese-gothic.ttf")
+img.annotate('Hello World')
+img.annotate('ようこそpgmagickへ!!')
+img.write('japanese-text.png')
diff --git a/example/draw.py b/example/draw.py
new file mode 100644
index 0000000..0c54a65
--- /dev/null
+++ b/example/draw.py
@@ -0,0 +1,13 @@
+from pgmagick import Image, Geometry, Color, \
+                     DrawableCircle, DrawableText
+
+im = Image(Geometry(300, 300), Color("yellow"))
+
+circle = DrawableCircle(100.0, 100.0, 20.0, 20.0)
+im.draw(circle)
+
+im.fontPointsize(65)
+im.font("/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/UnBatang.ttf")
+text = DrawableText(30, 250, "hello gm")
+im.draw(text)
+im.write('circle-text.png')
diff --git a/example/drawablelist.py b/example/drawablelist.py
new file mode 100644
index 0000000..a22974b
--- /dev/null
+++ b/example/drawablelist.py
@@ -0,0 +1,32 @@
+from pgmagick import Image, Geometry, Color, \
+                     DrawableAffine, DrawableCircle, DrawableCompositeImage, \
+                     DrawableText, DrawableList
+
+im = Image(Geometry(300, 300), Color("yellow"))
+circle = DrawableCircle(100.0, 100.0, 20.0, 20.0)
+im.fontPointsize(65)
+im.font("/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/UnBatang.ttf")
+text = DrawableText(30, 250, "hello gm")
+drawlist = DrawableList()
+drawlist.append(circle)
+drawlist.append(text)
+im.draw(drawlist)
+im.write('non-affine.png')
+
+im = Image(Geometry(300, 300), Color("yellow"))
+circle = DrawableCircle(100.0, 100.0, 20.0, 20.0)
+im.fontPointsize(65)
+im.font("/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/UnBatang.ttf")
+text = DrawableText(30, 250, "hello gm")
+drawlist = DrawableList()
+drawlist.append(DrawableAffine(0.9, 0.9, 0.1, 0.1, 0.5, 0.5))
+drawlist.append(circle)
+drawlist.append(text)
+im.draw(drawlist)
+im.write('affine.png')
+
+
+im = Image(Geometry(300, 300), Color("yellow"))
+d = DrawableCompositeImage(100, 150, im)
+im.draw(d)
+im.write('ttt.png')
diff --git a/example/example.png b/example/example.png
new file mode 100644
index 0000000..95504e1
Binary files /dev/null and b/example/example.png differ
diff --git a/example/gm.sh b/example/gm.sh
new file mode 100644
index 0000000..8f5dc49
--- /dev/null
+++ b/example/gm.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+gm convert X.jpg -sharpen 1 -quality 100 Y.jpg
+gm convert X.jpg -filter Sinc -resize 1000x1000 -sharpen 1 -quality 100 Y.jpg
+gm convert X.jpg -filter Sinc -resize 100x100 -sharpen 1 -quality 100 Y.jpg
+gm convert X.jpg -filter Sinc -resize 500x500 -sharpen 1 -quality 100 Y.jpg
diff --git a/example/gradient.py b/example/gradient.py
new file mode 100644
index 0000000..ee429d2
--- /dev/null
+++ b/example/gradient.py
@@ -0,0 +1,7 @@
+from pgmagick import Image, Geometry, Color
+
+im = Image(Geometry(400, 300), Color("transparent"))
+im.read("gradient:white-black")
+im.display()
+im.read("gradient:#f0f000-#f000f0")
+im.display()
diff --git a/example/gravity.py b/example/gravity.py
new file mode 100644
index 0000000..7e2c064
--- /dev/null
+++ b/example/gravity.py
@@ -0,0 +1,44 @@
+from pgmagick import Image, Geometry, Color, TypeMetric, \
+                     DrawableText, DrawableList, DrawableGravity, GravityType
+
+im = Image(Geometry(600, 600), Color("transparent"))
+
+im.fontPointsize(30)
+im.fillColor(Color("#f010f0"))
+im.strokeColor(Color("transparent"))
+im.font("Vera.ttf")
+dl = DrawableList()
+
+dl.append(DrawableGravity(GravityType.CenterGravity))
+dl.append(DrawableText(0, 0, "center"))
+
+tm = TypeMetric()
+im.fontTypeMetrics("northn", tm)
+font_height = tm.textHeight()
+dl.append(DrawableGravity(GravityType.NorthGravity))
+dl.append(DrawableText(0, font_height / 2., "north"))
+
+dl.append(DrawableGravity(GravityType.WestGravity))
+dl.append(DrawableText(0, 0, "west"))
+
+dl.append(DrawableGravity(GravityType.EastGravity))
+dl.append(DrawableText(0, 0, "east"))
+dl.append(DrawableText(0, 20, "east-long"))
+
+dl.append(DrawableGravity(GravityType.SouthGravity))
+dl.append(DrawableText(0, 0, "south"))
+
+dl.append(DrawableGravity(GravityType.NorthWestGravity))
+dl.append(DrawableText(0, font_height / 2., "north-west"))
+
+dl.append(DrawableGravity(GravityType.NorthEastGravity))
+dl.append(DrawableText(0, font_height / 2., "north-east"))
+
+dl.append(DrawableGravity(GravityType.SouthWestGravity))
+dl.append(DrawableText(0, 0, "south-west"))
+
+dl.append(DrawableGravity(GravityType.SouthEastGravity))
+dl.append(DrawableText(0, 0, "south-east"))
+
+im.draw(dl)
+im.write("test.png")
diff --git a/example/im.sh b/example/im.sh
new file mode 100644
index 0000000..4075686
--- /dev/null
+++ b/example/im.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+convert X.jpg -sharpen 1 -quality 100 Y.jpg
+convert X.jpg -filter Sinc -resize 1000x1000 -sharpen 1 -quality 100 Y.jpg
+convert X.jpg -filter Sinc -resize 100x100 -sharpen 1 -quality 100 Y.jpg
+convert X.jpg -filter Sinc -resize 500x500 -sharpen 1 -quality 100 Y.jpg
diff --git a/example/image_from_storage.py b/example/image_from_storage.py
new file mode 100644
index 0000000..5c341bc
--- /dev/null
+++ b/example/image_from_storage.py
@@ -0,0 +1,5 @@
+from pgmagick import Image, StorageType
+
+data = ["000" for i in range(100)]
+img = Image(100, 100, "RGB", StorageType.CharPixel, "".join(data))
+img.display()
diff --git a/example/imagelist.py b/example/imagelist.py
new file mode 100644
index 0000000..ef9e897
--- /dev/null
+++ b/example/imagelist.py
@@ -0,0 +1,14 @@
+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))
+print len(imgs)
+imgs.writeImages('output.gif')
+
+imgs = ImageList()
+imgs.readImages('output.gif')
+for img in imgs:
+    print img
diff --git a/example/pgmagick_prof.py b/example/pgmagick_prof.py
new file mode 100644
index 0000000..bbc5b39
--- /dev/null
+++ b/example/pgmagick_prof.py
@@ -0,0 +1,32 @@
+import sys
+from pgmagick import Image, FilterTypes as ft
+
+# same
+# convert SRC.jpg -filter Sinc -resize 500x500 -sharpen 1 -quality 100 DST.jpg
+# gm convert SRC.jpg -filter Sinc -resize 500x500 -sharpen 1 -quality 100 DST.jpg
+
+im = Image('./X.jpg')
+im.quality(100)
+im.sharpen(1.0)
+im.write('./Y.jpg')
+
+im = Image('./X.jpg')
+im.quality(100)
+im.filterType(ft.SincFilter)
+im.scale('1000x1000')
+im.sharpen(1.0)
+im.write('./Y.jpg')
+
+im = Image('./X.jpg')
+im.quality(100)
+im.filterType(ft.SincFilter)
+im.scale('100x100')
+im.sharpen(1.0)
+im.write('./Y.jpg')
+
+im = Image('./X.jpg')
+im.quality(100)
+im.filterType(ft.SincFilter)
+im.scale('500x500')
+im.sharpen(1.0)
+im.write('./Y.jpg')
diff --git a/example/pixels.py b/example/pixels.py
new file mode 100644
index 0000000..0dce368
--- /dev/null
+++ b/example/pixels.py
@@ -0,0 +1,15 @@
+from pgmagick import Image, Blob
+
+blob = Blob(open('X.jpg').read())
+img = Image(blob)
+size = img.size()
+pixels = img.getPixels(0, 0, size.width()/2, size.height()/2)
+
+for cnt, pixel in enumerate(pixels):
+    if False:
+        print(pixel.red, pixel.blue, pixel.green, pixel.opacity)
+    pixel.blue = pixel.blue / 2
+    pixel.green = pixel.green / 2
+    pixel.red = pixel.red / 2
+img.syncPixels()
+img.write("Xo.jpg")
diff --git a/example/profile.sh b/example/profile.sh
new file mode 100644
index 0000000..2c6d60c
--- /dev/null
+++ b/example/profile.sh
@@ -0,0 +1,38 @@
+#!/bin/zsh
+
+
+echo "==================================================="
+echo "[pgmagick (libGraphicsMagick++ wrapper for Python)]"
+for cnt in `seq 5`
+do
+    time python pgmagick_prof.py
+done
+ls -l Y.jpg
+mv Y.jpg Ypg.jpg
+
+echo "==================================================="
+echo "[PythonMagick(libMagick++ wrapper for Python)]"
+for cnt in `seq 5`
+do
+    time python pythonmagick_prof.py
+done
+ls -l Y.jpg
+mv Y.jpg Ypm.jpg
+
+echo "==================================================="
+echo "[ImageMagick(convert command)]"
+for cnt in `seq 5`
+do
+    time sh im.sh
+done
+ls -l Y.jpg
+mv Y.jpg Yim.jpg
+
+echo "==================================================="
+echo "[GraphicsMagick(gm convert command)]"
+for cnt in `seq 5`
+do
+    time sh gm.sh
+done
+ls -l Y.jpg
+mv Y.jpg Ygm.jpg
diff --git a/example/pythonmagick_prof.py b/example/pythonmagick_prof.py
new file mode 100644
index 0000000..31c6f61
--- /dev/null
+++ b/example/pythonmagick_prof.py
@@ -0,0 +1,28 @@
+from PythonMagick import *
+
+# same
+# convert SRC.jpg -filter Sinc -resize 500x500 -sharpen 1 -quality 100 DST.jpg
+# gm convert SRC.jpg -filter Sinc -resize 500x500 -sharpen 1 -quality 100 DST.jpg
+
+im = Image('./X.jpg')
+im.quality(100)
+im.sharpen(1.0)
+im.write('./Y.jpg')
+
+im = Image('./X.jpg')
+im.quality(100)
+im.scale('1000x1000')
+im.sharpen(1.0)
+im.write('./Y.jpg')
+
+im = Image('./X.jpg')
+im.quality(100)
+im.scale('100x100')
+im.sharpen(1.0)
+im.write('./Y.jpg')
+
+im = Image('./X.jpg')
+im.quality(100)
+im.scale('500x500')
+im.sharpen(1.0)
+im.write('./Y.jpg')
diff --git a/example/resize.py b/example/resize.py
new file mode 100644
index 0000000..4a3a73c
--- /dev/null
+++ b/example/resize.py
@@ -0,0 +1,5 @@
+from pgmagick import Image, FilterTypes
+im = Image('X.jpg')
+im.filterType(FilterTypes.SincFilter)
+im.resize('100x100')
+im.write('output.jpg')
diff --git a/example/writeimages_with_blob.py b/example/writeimages_with_blob.py
new file mode 100644
index 0000000..47336cf
--- /dev/null
+++ b/example/writeimages_with_blob.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+import pgmagick
+
+im = pgmagick.Image('existing.tif')
+
+pdf = pgmagick.ImageList()
+pdf.append(im)
+pdf.append(im)
+pdf.writeImages('new.pdf')
+
+blob = pgmagick.Blob()
+pdf.writeImages(blob)
+print blob.length()
diff --git a/pgmagick.egg-info/PKG-INFO b/pgmagick.egg-info/PKG-INFO
index c0ea39e..4347c89 100644
--- a/pgmagick.egg-info/PKG-INFO
+++ b/pgmagick.egg-info/PKG-INFO
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: pgmagick
-Version: 0.6.5
+Version: 0.7.2
 Summary: Yet Another Python wrapper for GraphicsMagick
 Home-page: https://github.com/hhatto/pgmagick
 Author: Hideo Hattori
 Author-email: hhatto.jp at gmail.com
 License: MIT
+Description-Content-Type: UNKNOWN
 Description: About
         =====
         
@@ -49,8 +50,8 @@ Description: About
         MacOSX
         ------
         
-        via homebrew-cask(homebrew-pgmagick)
-        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        via homebrew-cask(homebrew-pgmagick) with Python2
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         use `homebrew-pgmagick`_ ::
         
             $ brew tap hhatto/pgmagick
@@ -58,28 +59,36 @@ Description: About
         
         .. _`homebrew-pgmagick`: https://github.com/hhatto/homebrew-pgmagick
         
-        via homebrew and pip
-        ~~~~~~~~~~~~~~~~~~~~
-        *update 2014.05.12*
-        on MacOSX 10.9.2 (add ARCHFLAGS)::
+        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 --with-python
-            $ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pgmagick
+            $ brew install boost-python --with-python3
+            $ pip install pgmagick
         
-        *update 2013.08.31*
-        with Homebrew_ ::
+        via homebrew and pip with Python2
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        *update 2017.05.17*
+        on MacOSX 10.11.6::
         
-            $ brew install graphicsmagick     # or imagemagick
-            $ brew install boost --with-thread-unsafe --build-from-source
+            $ brew install graphicsmagick
+            $ brew install boost-python
             $ pip install pgmagick
         
-        install reported on MacOSX, Thanks Rohan Singh and Simon Harrison.
+        *update 2014.05.12*
+        on MacOSX 10.9.2 (add ARCHFLAGS)::
         
-        - http://rohanradio.com/blog/2011/12/02/installing-pgmagick-on-os-x/
-        - http://simonharrison.info/talk/2011/01/17/pgmagick-on-mac-os/ (old)
+            $ brew install graphicsmagick
+            $ brew install boost --with-python
+            $ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pgmagick
         
-        .. _Homebrew: http://brew.sh/
         
         Windows
         -------
@@ -110,14 +119,21 @@ Description: About
         
         scale example::
         
-            >>> from pgmagick import Image, FilterTypes
+            >>> from pgmagick import Image
             >>> im = Image('input.jpg')
             >>> im.quality(100)
-            >>> im.filterType(FilterTypes.SincFilter)
             >>> 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
@@ -174,12 +190,10 @@ Description: About
         * PyPI_
         * `Project Page`_
         * `Project Page (Old)`_
-        * `CI(Jenkins)`_
         
         .. _PyPI: http://pypi.python.org/pypi/pgmagick/
         .. _`Project Page`: https://github.com/hhatto/pgmagick/
         .. _`Project Page (Old)`: https://bitbucket.org/hhatto/pgmagick/
-        .. _`CI(Jenkins)`: http://jenkins.hexacosa.net/job/pgmagick/
         
 Keywords: GraphicsMagick ImageMagick graphics boost image
 Platform: UNKNOWN
diff --git a/pgmagick.egg-info/SOURCES.txt b/pgmagick.egg-info/SOURCES.txt
index 6e43536..b52ceed 100644
--- a/pgmagick.egg-info/SOURCES.txt
+++ b/pgmagick.egg-info/SOURCES.txt
@@ -3,6 +3,7 @@ MANIFEST.in
 Makefile
 README.rst
 setup.py
+./src/_ArrayProxy.h
 ./src/_Blob.cpp
 ./src/_ChannelType.cpp
 ./src/_Color.cpp
@@ -98,6 +99,7 @@ setup.py
 ./src/_PathSmoothQuadraticCurvetoAbs.cpp
 ./src/_PathSmoothQuadraticCurvetoRel.cpp
 ./src/_Pixels.cpp
+./src/_Pixels.h
 ./src/_QuantumOperator.cpp
 ./src/_QuantumType.cpp
 ./src/_RenderingIntent.cpp
@@ -112,6 +114,25 @@ setup.py
 ./src/_VirtualPixelMethod.cpp
 ./src/_gminfo.cpp
 ./src/_main.cpp
+example/X.jpg
+example/bezier.py
+example/blob.py
+example/draw.py
+example/drawablelist.py
+example/example.png
+example/gm.sh
+example/gradient.py
+example/gravity.py
+example/im.sh
+example/image_from_storage.py
+example/imagelist.py
+example/pgmagick_prof.py
+example/pixels.py
+example/profile.sh
+example/pythonmagick_prof.py
+example/resize.py
+example/writeimages_with_blob.py
+example/docs/japanese-text.py
 pgmagick/__init__.py
 pgmagick/_version.py
 pgmagick/api.py
@@ -120,6 +141,8 @@ pgmagick.egg-info/SOURCES.txt
 pgmagick.egg-info/dependency_links.txt
 pgmagick.egg-info/top_level.txt
 src/Makefile
+src/_ArrayProxy.h
+src/_Pixels.h
 test/test_cookbook.py
 test/test_pgmagick_api.py
 test/test_pgmagick_blob.py
diff --git a/pgmagick/_version.py b/pgmagick/_version.py
index e2f45ae..fb9b668 100644
--- a/pgmagick/_version.py
+++ b/pgmagick/_version.py
@@ -1 +1 @@
-__version__ = '0.6.5'
+__version__ = '0.7.2'
diff --git a/pgmagick/api.py b/pgmagick/api.py
index f013c10..b2f3609 100644
--- a/pgmagick/api.py
+++ b/pgmagick/api.py
@@ -712,12 +712,14 @@ class Image(object):
         elif isinstance(size, (list, tuple)):
             scaled_width, scaled_height = int(size[0]), int(size[1])
             size = "%dx%d" % (int(scaled_width), int(scaled_height))
+        geometry = pgmagick.Geometry(size)
         if filter_type:
             filter_type = getattr(pgmagick.FilterTypes,
                                   "%sFilter" % filter_type.title())
-            pgmagick.Image.filterType(self.img, filter_type)
-        geometry = pgmagick.Geometry(size)
-        self.img.scale(geometry)
+            self.img.filterType(filter_type)
+            self.img.zoom(geometry)
+        else:
+            self.img.scale(geometry)
 
     # API of Set/Get Image
     def font_pointsize(self, point_size=None):
diff --git a/setup.cfg b/setup.cfg
index 861a9f5..8bfd5a1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff --git a/setup.py b/setup.py
index 00a1bde..f74f2fd 100644
--- a/setup.py
+++ b/setup.py
@@ -36,6 +36,20 @@ if sys.platform.lower() == 'darwin':
     search_include_dirs.append('/opt/local/include/ImageMagick/')
 
 
+if 'MAGICK_HOME' in os.environ:
+    extra_include_dir = os.path.join(os.environ['MAGICK_HOME'], 'include')
+    print('adding extra include directory %s' % extra_include_dir)
+    search_include_dirs.insert(0, extra_include_dir)
+
+    extra_library_dir = os.path.join(os.environ['MAGICK_HOME'], 'lib')
+    print('adding extra library directory %s' % extra_library_dir)
+    search_library_dirs.insert(0, extra_library_dir)
+
+    extra_pkgconfig_dir = os.path.join(extra_library_dir, 'pkgconfig')
+    print('adding extra pkgconfig directory %s' % extra_pkgconfig_dir)
+    search_pkgconfig_dirs.insert(0, extra_pkgconfig_dir)
+
+
 def _grep(regex, filename):
     for line in open(filename):
         if re.search(regex, line):
@@ -58,8 +72,11 @@ def get_version_from_pc(search_dirs, target):
         for root, dirs, files in os.walk(dirname):
             for f in files:
                 if f == target:
-                    _tmp = _grep("Version: ", os.path.join(root, target))
-                    return _tmp.split()[1]
+                    file_path = os.path.join(root, target)
+                    _tmp = _grep("Version: ", file_path)
+                    version = _tmp.split()[1]
+                    print("Found version %s in file %s" % (version, file_path))
+                    return version
 
 
 def find_file(filename, search_dirs):
@@ -75,6 +92,25 @@ def find_file(filename, search_dirs):
                 return root
     return False
 
+
+def library_supports_api(library_version, api_version, different_major_breaks_support=True):
+    """
+    Returns whether api_version is supported by given library version.
+    E. g.  library_version (1,3,21) returns True for api_version (1,3,21), (1,3,19), (1,3,'x'), (1,2,'x'), (1, 'x')
+           False for (1,3,24), (1,4,'x'), (2,'x')
+
+    different_major_breaks_support - if enabled and library and api major versions are different always return False
+           ex) with library_version (2,0,0) and for api_version(1,3,24) returns False if enabled, True if disabled
+    """
+    assert isinstance(library_version, (tuple, list))  # won't work with e.g. generators
+    assert len(library_version) == 3
+    sequence_type = type(library_version)  # assure we will compare same types
+    api_version = sequence_type(0 if num == 'x' else num for num in api_version)
+    if different_major_breaks_support and library_version[0] != api_version[0]:
+        return False
+    assert len(api_version) <= 3     # otherwise following comparision won't work as intended, e.g. (2, 0, 0) > (2, 0, 0, 0)
+    return library_version >= api_version
+
 # find to header path
 header_path = find_file('Magick++.h', search_include_dirs)
 if not header_path:
@@ -91,6 +127,7 @@ if _python_version >= (3, ):
     boost_lib_target_files.append("boost_python-py%s%s" % (_python_version[0], _python_version[1]))
     # ArchLinux uses boost_python3
     boost_lib_target_files.append("boost_python3")
+    boost_lib_target_files.append("boost_python3-mt")
 boost_lib_target_files.append("boost_python-mt-py%s%s" % (_python_version[0], _python_version[1]))
 # gentoo appends the python version numbers to the boost_python libraries
 boost_lib_target_files.append("boost_python-%s.%s" % (_python_version[0], _python_version[1]))
@@ -138,21 +175,10 @@ if _version:
         # ex) 1.2 -> 1.2.0
         _version.append(0)
     if LIBRARY == 'GraphicsMagick':
-        ext_compile_args = []
-        if _version[0] == 1 and _version[1] == 3 and _version[2] >= 24:
-            ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_24")
-        if _version[0] == 1 and _version[1] == 3 and _version[2] >= 22:
-            ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_22")
-        if _version[0] == 1 and _version[1] == 3 and _version[2] >= 20:
-            ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_20")
-        if _version[0] == 1 and _version[1] == 3 and _version[2] == 19:
-            ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_19")
-        if _version[0] == 1 and _version[1] == 3 and _version[2] >= 6:
-            # for not Ubuntu10.04
-            ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6")
-        if not (_version[0] == 1 and _version[1] == 1):
-            # for GM version 1.3.x and higher
-            ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x")
+        # 1.3.6 for not Ubuntu10.04
+        _tested_api_versions = ((1,3,26), (1,3,24), (1,3,22), (1,3,20), (1,3,19), (1,3,6), (1,3,'x'))
+        _supported_api_versions = (v for v in _tested_api_versions if library_supports_api(_version, v))
+        ext_compile_args = ["-DPGMAGICK_LIB_GRAPHICSMAGICK_" + '_'.join(map(str, version)) for version in _supported_api_versions]
     elif LIBRARY == 'ImageMagick':
         ext_compile_args = ["-DPGMAGICK_LIB_IMAGEMAGICK"]
     ext_compile_args.append("-D_LIBRARY_VERSION=\"%s\"" % (_str_version))
@@ -167,6 +193,7 @@ def version():
             if line.startswith('__version__'):
                 return ast.parse(line).body[0].value.s
 
+
 setup(name='pgmagick',
       version=version(),
       description="Yet Another Python wrapper for GraphicsMagick",
diff --git a/src/Makefile b/src/Makefile
index d9d267d..fa16b33 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,6 +3,8 @@ FLAGS = -Wall
 INCS = -I/usr/include/python2.7 -I/usr/include/GraphicsMagick
 SO = _pgmagick.so
 LIBS = -lboost_python -lGraphicsMagick++
+LINK_FLAGS = -fPIC -shared
+#LINK_FLAGS = -bundle -undefined dynamic_lookup		# for macOS
 OBJS = _Blob.o \
        _ChannelType.o \
        _Color.o \
@@ -116,7 +118,7 @@ OBJS = _Blob.o \
 .SUFFIXES: .cpp .o
... 962 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pgmagick.git



More information about the Python-modules-commits mailing list