[PYTHON] Install pgmagick on Mac OS X 10.9

What is pgmagick

pgmagick

pgmagick is a convenient package for processing images with python. It seems to wrap an image processing tool called GraphicsMagick. (It seems to work with ImageMagick, but I haven't tried it.)

Installation of pgmagick

The environment is

is

$ brew install graphicsmagick     # or imagemagick
$ brew install boost --with-thread-unsafe --build-from-source
$ pip install pgmagick

I could install it above, but I couldn't install it successfully.

homebrew settings

Check with the brew doctor to see if homebrew is out of order.

pip install pgmagick doesn't work

When you run pip install pgmagick,

clang: error: unknown argument: '-mno-fused-madd

Error was displayed and the installation could not be completed successfully.

I tried setting the environment variable because it works when I set the environment variable, but it didn't work either, so I installed it with the help of stackoverflow.

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pgmagick

clang error: unknown argument: '-mno-fused-madd' (python package installation failure)

Installation takes time

brew install boost --with-thread-unsafe --build-from-source The command takes a lot of time, so it takes about 35 minutes </ strong>.


Let's move

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

OK if the version etc. is displayed.

sample

>>> 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')

Reduces the images on the folder to 100px (either vertically or horizontally longer).

output.jpg

Sample image reduced to 100px.


end

There are many image-related items, but they are relatively easy and convenient, so please give them a try.

Recommended Posts

Install pgmagick on Mac OS X 10.9
Install Sphinx on Mac OS X
Install mitmproxy on Mac OS X
Memo on Mac OS X
Very easy to install SciPy on Mac OS X
Install Scipy on Mac OS Sierra
Install PyQt5 with homebrew on Mac OS X Marvericks (10.9.2)
How to install Theano on Mac OS X with homebrew
Install matplotlib on OS X El Capitan
Run NASA CEA on Mac OS X
Install Tensorflow on Mac
Install pyenv on mac
Install Ansible on Mac
Install Python 3 on Mac
Install Python 3.4 on Mac
Install Caffe on Mac
Install mecab on mac
Install lp_solve on Mac OS X and call it with python.
How to install Theano on Mac OS X 10.10 (using pyenv, anaconda)
Run Zookeeper x python (kazoo) on Mac OS X
Shpinx (Python documentation builder) on Mac OS X
Install tomcat 9 on Cent OS 8
Install module on Anaconda (Mac)
Install OpenPose on mac (Catalina)
Install pandas 0.14 on python3.4 [on Mac]
Install Django on your Mac
Install pillow on Mac OSX 10.9
[Mac] Tips: Install pyquery on Mac [pyquery]
Preparing to use aws cli on Mac OS X
Building an environment for "Tello_Video" on Mac OS X
How to install caffe on OS X with macports
Build a Python development environment on Mac OS X
mac OS X 10.15.x pyenv Python If you can't install
Install Python 3.8 on Ubuntu 18.04 (OS standard)
Using multiple versions of Python on Mac OS X (2) Usage
Install anaconda on Mac → Add Library
How to install mysql-connector-python on mac
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
Install Adopt OpenJDK 11 on Cent OS 8
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Steps to install matplotlib on Mac
Installation of scikit-learn (Mac OS X)
Install Python 3.7 Anaconda on MAC, but Python 2
Install python3 on Mac (El Capitan)
How to install OpenCV on Mac
Install VirtualBox on CentOS 7 on VirtualBox (mac + vagrant)
Install Python 3.9 on Ubuntu 20.04 (OS standard?)
Install Python 2.7 on Ubuntu 20.04 (OS standard?)
Steps to install python3 on mac
Get started with the Python framework Django on Mac OS X
Using multiple versions of Python on Mac OS X (1) Multiple Ver installation
Continuation ・ Notes on preparing the Python development environment on Mac OS X
Quickly install OpenCV 2.4 (+ python) on OS X and try the sample
Mac OS X Mavericks 10.9.5 Development environment construction
Install opencv on Mac using Anaconda Navigator
How to install drobertadams / toggl-cli on Mac
How to erase Python 2.x on Mac.
Install 64-bit OS (bate) on Raspberry Pi
GeoDjango + SQLite environment construction on OS X
Mac OS X Yosemite 10.10 Development environment construction
Install anaconda on a new Mac anyway