ImageMagickは 画像表示と画像処理を行なうUNIXソフトのWindows移植版です.
オリジナルのUNIX版での主な機能を以下に示します.
| display | : | 各種イメージの表示,編集 |
| import | : | 表示されているウインドウを各種イメージファイルにダンプ |
| animate | : | 指定されたイメージのシーケンスをアニメーション化 |
| montage | : | イメージをモンタージュ写真のように合成 |
| convert | : | 入力されたイメージを指定された各種フォーマットに出力 |
| mogrify | : | イメージの拡大・回転 |
| identify | : | 指定されたイメージに関する情報を出力 |
ただしWindows移植版はGUIでの操作はできず,コマンドラインからの操作のみとなるため 上記の montage,convert,mogrify,identifyに機能が制限されます.
インストールはImageMagickを展開するだけです. 全ての *.exe及び *.dllをPATHの通った ディレクトリ(ここでも /usr/binとします)にコピーします. これで任意のディレクトリに対してコマンドプロンプトから使用可能ですが convert.exeは既にWindowsのシステムに存在していますので
c:\usr\bin\convert.exe
と記述した
convert.batを
c:\usr\binに入れておき,
convert.bat <option>として起動するとよいでしょう.
画像ビューワであり,かつImageMagickをGUIで操作します.なお起動コマンドはdisplayです.imagemagick等ではありません.
以下はImageMagick V5.2.5 on Debian/GNU Linux potatoでのものです.
任意のX Windowのスクリーンショットを撮ります.import コマンドを実行すると、マウスカーソルが + マークに代わり、スクリーンショットを 撮りたいウィンドウをクリックするとビープ音が鳴り, output fileが作成されます.
import [ options ... ]
<output file>
以下は指定可能なオプションです.
画像ファイルの変換を行います.またその際にさまざまなオプションを指定することができます.
convert [ options ... ] input_file output_file
対応しているフォーマット形式は以下です.
赤文字で拡張子が 拡張子+の形で表示されているものは,マルチイメージファイルが可能なファイルで, 複数のイメージファイルから作成されている可能性があるものです.
| AVS | AVS X image file. | PCD | Photo CD. The maximum resolution written is 512x768 pixels. | |
| BIE+ | Joint Bi-level Image experts Group file interchange format. | PCDS | Photo CD. Decode with the sRGB color table. | |
| BMP+ | Microsoft Windows bitmap image file. | PCL | Page Control Language. | |
| BMP24+ | Microsoft Windows 24-bit bitmap image file. | PCX | ZSoft IBM PC Paintbrush file. | |
| CGM | Computer Graphics Metafile. | PDF+ | Portable Document Format. | |
| CMYK | Raw cyan, magenta, yellow, and black bytes. | PGM+ | Portable graymap format (gray scale). | |
| DCX+ | ZSoft IBM PC multi-page Paintbrush file. | PICT | Apple Macintosh QuickDraw/PICT file. | |
| DIB | Microsoft Windows bitmap image file. | PIX | Alias/Wavefront RLE image format. | |
| DICOM | Medical image file. | PLASMA | plasma fractal image. Specify the base color as the filename. | |
| EPDF | Encapsulated Portable Document Format. | PNG | Portable Network Graphics. | |
| EPI | Adobe Encapsulated PostScript Interchange format. | PNM+ | Portable anymap. | |
| EPS | Adobe Encapsulated PostScript file. | PPM+ | Portable pixmap format (color). | |
| EPS2 | Adobe Level II Encapsulated PostScript file. | PS+ | Adobe PostScript file. | |
| EPSF | Adobe Encapsulated PostScript file. | PSD | Adobe PhotoShop bitmap file. | |
| EPSI | Adobe Encapsulated PostScript Interchange format. | PS2+ | Adobe Level II PostScript file. | |
| EPT | Adobe Encapsulated PostScript Interchange format with TIFF preview. | RAD | Radiance image file. | |
| FAX+ | Group 3. | RGB | Raw red, green, and blue bytes. | |
| FIG | TransFig image format. | RGBA | Raw red, green, blue, and matte bytes. | |
| FITS | Flexible Image Transport System. | RLA | Alias/Wavefront image file; read only. | |
| FPX | FlashPix Format. | RLE | Utah Run length encoded image file; read only. | |
| GIF | CompuServe graphics interchange format; 8-bit color. | SGI+ | Irix RGB image file. | |
| GIF87 | CompuServe graphics interchange format; 8-bit color (version 87a). | SHTML | Hypertext Markup Language a with client-side image map. | |
| GRAY | Raw gray bytes. | SUN+ | SUN Rasterfile. | |
| GRADIENT | gradual passing from one shade to another. | SVG+ | Scalable Vector Graphics. | |
| GRANITE | granite texture. | TEXT | raw text file; read only. | |
| HDF+ | Hierarchical Data Format. | TGA+ | Truevision Targa image file. | |
| HISTOGRAM | TIFF+ | Tagged Image File Format. | ||
| HPGL | HP-GL plotter language. | TIFF24+ | 24-bit Tagged Image File Format. | |
| HTML | Hypertext Markup Language a with client-side image map. | TILE | tile image with a texture. | |
| JBIG+ | Joint Bi-level Image experts Group file interchange format. | TIM | PSX TIM file. | |
| JPEG | Joint Photographic Experts Group JFIF format; compressed 24-bit color. | TTF | TrueType font file. | |
| ICO | Microsoft icon. | UIL | X-Motif UIL table. | |
| LABEL | text image. | UYVY | Interleaved YUV. | |
| MAP | colormap intensities and indices. | VICAR | read only. | |
| MIFF+ | Magick image file format. | VID | Visual Image Directory. | |
| MNG+ | Multiple-image Network Graphics. | VIFF+ | Khoros Visualization image file. | |
| MONO | Bi-level bitmap in least-significant-byte (LSB) first order. | WIN | select image from or display image to your computer screen. | |
| MPEG+ | Motion Picture Experts Group file interchange format. | X | select image from or display image to your X server screen. | |
| MTV+ | XC | constant image of X server color. Specify the image color as the filename (e.g. xc:yellow). | ||
| MVG | Magick Vector Graphics. | XBM | X Windows system bitmap, black and white only. | |
| M2V+ | Motion Picture Experts Group file interchange format (version 2). | XPM | X Windows system pixmap file (color). | |
| NETSCAPE | Netscape 216 color cube. | XWD | X Windows system window dump file (color). | |
| NULL | NULL image. | YUV+ | CCIR 601 4:1:1 file. | |
| PBM+ | Portable bitmap format (black and white). | |||
指定できるオプションはかなりの数あるので,ここではよく使いそうなものや便利なものだけを紹介します.さらに詳しい設定についてはマニュアルを参照してください.
元画像はこちらとします.
convert magick-small.png magick1.gif
convert -flop magick1.gif magick2.gif
magick1.gif
magick2.gif
magick-append.gif
magick-average.gif
magick-blur.gif
magick-border.gif
magick-bordercolor.gif
magick-channel-blue.gif
magick-channel-green.gif
magick-channel-matte.gif
magick-channel-red.gif
magick-charcoal.gif
magick-colorize.gif
magick-contrast.gif
magick-crop.gif
magick-crop2.gif
AnimationGIFの作り方
-delay 100 で画像が切り替わるまでの時間を1/100(s)で指定.-loopを指定しなければ,1度だけのアニメーションとなり,loop 0 で無限回,数字を指定した場合はその回数のアニメーションに.アニメーション化したい画像ファイルを以下のように連番で指定.magick*.gifのような指定も可.
convert -delay 100 -loop 0 magick[1-2].gif magick-anime.gif
magick-anime.gif
magick-edge.gif
magick-emboss.gif
magick-equalize.gif
magick-flip.gif
magick-flop.gif
magick-frame.gif
magick-frame-color.gif
magick-gamma.gif
magick-geometry.gif
magick-implode.gif
magick-transparent.gif
magick-monochrome.gif
magick-negate.gif
magick-median.gif
magick-raise.gif
magick-roll.gif
magick-rotate.gif
magick-segment.gif
magick-shade.gif
magick-spread.gif
magick-swirl.gif
magick-threshold.gif
magick-wave.gif
複数の画像から1枚のサムネイルを作成します.
montage magick1.gif magick2.gif magick-crop.gif magick-montage.gif
magick-montage.gif
画像ファイルの情報を表示します.画像の大きさや使用しているcolorなどの詳しい情報を得ることができます.
identify -verbose magick1.gif
Image: magick1.gif
Format: GIF (CompuServe graphics interchange format)
Geometry: 129x133
Class: PseudoClass
Type: palette
Depth: 8-bits
Colors: 256
0: ( 257, 257, 257) #010101
1: ( 514, 1028, 2570) #02040a
2: ( 2827, 2570, 2313) #0b0a09
3: ( 3341, 1799, 1285) #0d0705
・
・
・
253: (62708,62708,62708) #f4f4f4
254: (65535,65535,65535) white
255: ( 0, 0, 0) black
Filesize: 19kb
Interlace: None
Background Color: white
Border Color: #dfdfdf
Matte Color: grey74
Page Geometry: 129x133+0+0
Delay: 100
Compression: LZW
Signature: 67ce453495a4a52647bad25ddcab742b
Tainted: False
User Time: 0.0u
Elapsed Time: 0:01
|
複数の画像を合成します.なお,V5.2.5ではcombineコマンドですが,私の知る限りV5.3.5以降ではcompositeコマンドになっているようです.どのバージョンで変更になったかなどはわかっていません.
combineコマンドを使う例を紹介します.なお,以下はImageMagick V5.2.5 on Debian/GNU Linuxで行いました.V5.3.7 on Windowsでは上手く合成できません.
まず,以下のような画像ファイルを作成.
logo.png
文字の色を変更(赤色に).なお,これにはdisplayを使用.(convertではどうするのでしょう?)
logo-red.png
ぼかして影になる部分を作成.
convert -blur 2x2 logo.png logo-blur.png
logo-blur.png
影になる部分の文字を少しずらす.
convert -roll +5+5 logo.png logo-roll.png
logo-roll.png
重ねる.はじめに指定したほうが下側.
combine -compose over logo-roll.png logo-red.png title.png
logo-title.png
フレームを付けてみる.
convert -frame 12x12+4+4 -mattecolor #8080ff logo-red.png title-frame.png
title-frame.png