ターミナル

HomebrewでImageMagickをインストールする

ImageMagickは画像を変換、編集などできるフリーソフトでターミナルで動かします。
画像の拡大・縮小・合成・回転などコマンドを使いこなせさえすれば基本的に幅広く可能です。

今回はImageMagickのインストール方法をまとめていきます。

環境

MacOS High Sierra バージョン 10.13.6

Homebrewをインストールする

今回Homebrewを使ってインストールしていきます。なので入っていない場合はインストールしましょう。
Homebrewのインストール方法は以下の記事で解説しています。ですが実際には1行コマンドを叩くだけで大丈夫なので載せておきます。

【簡単】MacにHomebrewをインストールする方法と基本的な使い方HomebrewはmacOS用のパッケージ管理システムです。Homebrewを使うことでターミナル上でソフトウェアやライブラリを簡単にインストールすることができます。今回はHomebrewのインストール方法と基本的な使い方を誰でもわかるようにまとめていきたいと思います。...

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrewが正しくインストールされているかどうかは、


brew help

を実行して、コマンド一覧が表示されれば正しくインストールされています。

HomebrewでImageMagickのインストール

以下を実行するだけです。


$ brew install imagemagick

実行するとこのようになりました。


$ brew install imagemagick
==> Installing dependencies for imagemagick: libpng, freetype, jpeg, libde265, gettext, libffi, pcre, gdbm, openssl, readline, sqlite, xz, python, glib, shared-mime-info, x265, libheif, libomp, libtiff, libtool, little-cms2, ilmbase, openexr, openjpeg and webp
==> Installing imagemagick dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.36.high_sierra.b
######################################################################## 100.0%
==> Pouring libpng-1.6.36.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/libpng/1.6.36: 27 files, 1.2MB
==> Installing imagemagick dependency: freetype
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.10.0.high_sierra
######################################################################## 100.0%
==> Pouring freetype-2.10.0.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/freetype/2.10.0: 61 files, 2.3MB
==> Installing imagemagick dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9c.high_sierra.bottle.
######################################################################## 100.0%
==> Pouring jpeg-9c.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/jpeg/9c: 21 files, 724.5KB
==> Installing imagemagick dependency: libde265
==> Downloading https://homebrew.bintray.com/bottles/libde265-1.0.3.high_sierra.
######################################################################## 100.0%
==> Pouring libde265-1.0.3.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/libde265/1.0.3: 22 files, 2MB
==> Installing imagemagick dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.high_sierr

︙

In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.

以下を実行してちゃんと表示されれば正常にインストールができています。


$ convert
Version: ImageMagick 7.0.8-33 Q16 x86_64 2019-03-13 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP 
Delegates (built-in): bzlib freetype heic jng jp2 jpeg lcms ltdl lzma openexr png tiff webp xml zlib
Usage: convert [options ...] file [ [options ...] file ...] [options ...] file

Image Settings:
  -adjoin              join images into a single multi-image file
  -affine matrix       affine transform matrix
  -alpha option        activate, deactivate, reset, or set the alpha channel
  -antialias           remove pixel-aliasing
  -authenticate password

︙
︙

By default, the image format of 'file' is determined by its magic
number.  To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps).  Specify 'file' as
'-' for standard input or output.
$

正常にインストールできていることが確認できました。