2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ちょっと古いmacOSでeps画像を作る方法

Last updated at Posted at 2025-06-30

eps画像を作りたい

epsとは画像形式の一種です。大判印刷の画像データなどに用いられるそうです。自分はLatexに画像を挿入しようとした際に、epsのみ対応だったことで必要に迫られました。

結局、HomebrewがmacOS 12でサポート終了したことが最大の問題でした。

環境

・macOS Mounterey version 12.7.6
・anacondaをインストール済み
・Homebrewをインストール済み

うまくいった方法

pythonのPillowを使って変換

Pillowのインストール

conda install anaconda::pillow

インストールできたら以下のプログラムを走らせます。

import glob
import os
from PIL import Image

image_files = glob.glob("./*.png")

for image_file in image_files:
    im = Image.open(image_file)
    fig = im.convert('RGB')
    base_name = os.path.splitext(image_file)[0]
    fig.save(base_name + '.eps', format='EPS')

今回、image_files = glob.glob("./*.png")、と指定して一括でpngファイルを変換しましたが、pillowに対応している画像形式ならpngでなくても動くと思います。

うまくいかなかった方法

Homebrewを使ったパッケージのインストール

むしろここからが今回の本題で、HomebrewがmacOS 12でサポート終了してました。悲しい。brewをmacOSのversion 12.7.6で実行すると以下のようなエラーを吐きます。

Error: You are using macOS 12.
We (and Apple) do not provide support for this old version.

しかも、エラーが出るまでに30分以上時間がかかりました。macOS 12でbrewを動かすとすごい時間がかかるみたいです1。ちょっと古いOSの宿命です。

(1) ImageMagickによる変換

macで他の画像形式をepsに変換する方法を調べると、ImageMagickを使った方法がよく出てきます。やり方としては、

brew install imagemagick

でImageMagickをインストールしたのち、

convert sample.jpg sample.eps

というふうに変換できるそうです。ここでは、jpgをepsに変換する例を示しています。
しかしながら、brew install imagemagick、がHomebrewのエラーでインストールできず。

(2) popplerによる変換

これもImageMagickと同様に使えるみたいです。

brew install poppler

インストールしたのちに以下で変換します。

pdftops -eps input.pdf output.eps

これも、brew install poppler、がHomebrewのエラーでインストールできず。

  1. 同様の挙動を述べてるブログ。https://www.lorenzobettini.it/2025/01/macos-12-bye-bye-homebrew/

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?