| 1 |
%#!rm -f tigerpsdfmt4* && lualatex -shell-escape graphicxpsd |
| 2 |
\documentclass[luatex]{article} |
| 3 |
\usepackage{shortvrb}\MakeShortVerb{\|} |
| 4 |
\usepackage{hyperref} |
| 5 |
\usepackage{graphicx} |
| 6 |
\usepackage{graphicxpsd} |
| 7 |
\title{\textsf{graphicxpsd} Package} |
| 8 |
\author{Munehiro Yamamoto} |
| 9 |
\date{2026/03/01 v2.0} |
| 10 |
\begin{document} |
| 11 |
\maketitle |
| 12 |
\begin{abstract} |
| 13 |
This package provides Adobe Photoshop Data format (PSD) support |
| 14 |
for the \textsf{graphicx} package |
| 15 |
using the \texttt{sips} (Darwin/macOS) or \texttt{magick} (ImageMagick) commands. |
| 16 |
\end{abstract} |
| 17 |
|
| 18 |
\section{Motivation} |
| 19 |
The \textsf{graphicx} package already supports many graphics image formats as below. |
| 20 |
\begin{itemize} |
| 21 |
\item non-vector formats: jpg, png, bmp, and so on |
| 22 |
\item PostScript-style formats: eps, ps |
| 23 |
\item PDF-style formats: pdf, ai |
| 24 |
\end{itemize} |
| 25 |
However, it currently does not support the Adobe Photoshop Data format (PSD). |
| 26 |
To address this, we developed the \textsf{graphicxpsd} package |
| 27 |
to support the PSD format via PSD-to-PDF conversion |
| 28 |
using two image converters. |
| 29 |
\begin{itemize} |
| 30 |
\item \texttt{sips}: |
| 31 |
pre-installed command in Darwin/macOS |
| 32 |
|
| 33 |
\item \texttt{magick}: |
| 34 |
bundled command in \href{https://www.imagemagick.org/}{ImageMagick} |
| 35 |
\end{itemize} |
| 36 |
|
| 37 |
\section{Loading the \textsf{graphicxpsd} Package} |
| 38 |
|
| 39 |
Load the \textsf{graphicxpsd} package after loading the \textsf{graphicx} package. |
| 40 |
\begin{quote} |
| 41 |
\begin{verbatim} |
| 42 |
\usepackage{graphicx} |
| 43 |
\usepackage[<options>]{graphicxpsd} |
| 44 |
\end{verbatim} |
| 45 |
\end{quote} |
| 46 |
|
| 47 |
The list of available options is as follows: |
| 48 |
\begin{itemize} |
| 49 |
\item |dvipdfmx|, |xetex|, |pdftex|, |luatex|: |
| 50 |
supported driver options; |
| 51 |
You can also specify a driver as a global document class option. |
| 52 |
|
| 53 |
\item |sips| (default), |
| 54 |
|magick| |
| 55 |
(same as |imagemagick|), |convert|\footnotemark: % , |
| 56 |
% |graphicsmagick|: |
| 57 |
supported image converters; |
| 58 |
\begin{itemize} |
| 59 |
\item |
| 60 |
Darwin/macOS users do not need to do anything |
| 61 |
unless choosing ImageMagick as the PSD-to-PDF converter. |
| 62 |
\item |
| 63 |
If you use ImageMagick~7, choose |magick|. |
| 64 |
\item |
| 65 |
If you use ImageMagick~6 or an older version, choose |convert|. |
| 66 |
% \item |
| 67 |
% If you use GraphicsMagick, you may choose |graphicsmagick|. |
| 68 |
\end{itemize} |
| 69 |
|
| 70 |
\item |cache=true|: enables image caching for all PSD files. |
| 71 |
If a cached image does not exist for a PSD file, |
| 72 |
\textsf{graphicxpsd} attempts PSD-to-PDF conversion for that file. |
| 73 |
\end{itemize} |
| 74 |
\footnotetext{When the ImageMagick project released ImageMagick~7, |
| 75 |
they changed the default command to \texttt{magick} |
| 76 |
to avoid naming conflicts with the Windows \texttt{convert.exe} utility.} |
| 77 |
|
| 78 |
\section{Example} |
| 79 |
|
| 80 |
Typeset the following {\LaTeX} document with Lua{\TeX} by enabling shell escape |
| 81 |
(i.e., run |lualatex -shell-escape|). |
| 82 |
\begin{quote} |
| 83 |
\small |
| 84 |
\begin{verbatim} |
| 85 |
%#!lualatex -shell-escape |
| 86 |
\documentclass[luatex]{article}%%set luatex driver as global option |
| 87 |
\usepackage{graphicx} |
| 88 |
\usepackage{graphicxpsd} |
| 89 |
\begin{document} |
| 90 |
\includegraphics{tigerpsdfmt.psd} |
| 91 |
\end{document} |
| 92 |
\end{verbatim} |
| 93 |
\end{quote} |
| 94 |
The result is shown below. |
| 95 |
\begin{center} |
| 96 |
\includegraphics{tigerpsdfmt.psd} |
| 97 |
\end{center} |
| 98 |
Incidentally, the \texttt{tigerpsdfmt.psd} file above is converted from |
| 99 |
the \texttt{tiger.eps} file (a.k.a.~``cubic spline tiger''), |
| 100 |
which comes with Ghostscript. |
| 101 |
\begin{quote} |
| 102 |
\small |
| 103 |
\begin{verbatim} |
| 104 |
$ file tigerpsdfmt.psd |
| 105 |
tigerpsdfmt.psd: Adobe Photoshop Image, 550 x 568, RGBA, 4x 8-bit channels |
| 106 |
\end{verbatim} |
| 107 |
\end{quote} |
| 108 |
|
| 109 |
\end{document} |