- MSLの要素・属性一覧
- add-noise要素
- annotate要素
- append要素
- blur要素
- border要素
- colorize要素
- charcoal要素
- chop要素
- color-floodfill要素
- comment要素
- composite要素
- contrast要素
- crop要素
- cycle-colormap要素
- despeckle要素
- display要素
- draw要素
- edge要素
- emboss要素
- enhance要素
- equalize要素
- flatten要素
- flip要素
- flop要素
- frame要素
- gamma要素
- get要素
- group要素
- image要素
- implode要素
- label要素
- level要素
- magnify要素
- map要素
- matte-floodfill要素
- median-filter要素
- minify要素
- msl要素
- modulate要素
- negate要素
- normalize要素
- oil-paint要素
- opaque要素
- print要素
- profile要素
- quantize要素
- query-font-metrics要素
- raise要素
- read要素
- reduce-noise要素
- repage要素
- resample要素
- resize要素
- roll要素
- rotate要素
- sample要素
- scale要素
- segment要素
- set要素
- shade要素
- shadow要素
- sharpen要素
- shave要素
- shear要素
- signature要素
- solarize要素
- spread要素
- stegano要素
- stereo要素
- strip要素
- swap要素
- swirl要素
- sync要素
- threshold要素
- transparent要素
- trim要素
- write要素
- 共通属性
- 定義済みプロパティ
- TIPS
- 小ネタ
- 参考
ImageMagickを使った画像処理、MSBuildのトピックも参照。
MSLの要素・属性一覧
ImageMagickのconjureで使われるMSL(Magick Scripting Language)の要素・属性を独自に調査したもの。調査したのはImageMagick 6.7.9-0ソース。
- 要素名、属性名の大文字小文字は区別されない
- プロパティ(変数)名の大文字小文字は区別される*1
- プロパティの値は属性値中で %[プロパティ名] と記述すれば参照できる
- ユーザー定義プロパティはコマンドラインオプションで conjure -プロパティ名1 値1 [-プロパティ名2 値2 ...] ... という形で指定できる
- 属性値中に \ を記述する場合は、 \\ とエスケープする必要がある
ほとんどの要素・属性は動作するか確認していない(加えて筆者が間違っている可能性も大いにある)。*2まだ進化中らしく仕様が良く変わっているようなので注意。
add-noise要素
- 概要
- ノイズを加える
- 属性
- channel, noise
annotate要素
- 概要
- テキストを描画する
- 属性
- affine, align, antialias, density, encoding, fill, family, font, geometry, gravity, pointsize, rotate, scale, skewX, skewY, stretch, stroke, strokewidth, style, text, translate, undercolor, weight, x, y
append要素
- 概要
- (未記入)
- 属性
- stack
blur要素
- 概要
- ぼかす
- 属性
- channel, geometry, radius, sigma
border要素
- 概要
- 縁をつける
- 属性
- compose, fill, geometry, height, width
colorize要素
- 概要
- カラー処理
- 属性
- fill, opacity
charcoal要素
- 概要
- 木炭画風にする
- 属性
- radius, sigma
chop要素
- 概要
- イメージの一部を切り落とす
- 属性
- geometry, height, width, x, y
color-floodfill要素
- 概要
- (未記入)
- 属性
- bordercolor, fill, fuzz, geometry, x, y
comment要素
- 概要
- (未記入)
- 備考
- 現在は機能していない
composite要素
- 概要
- イメージを合成
- 属性
- blend, channel, color, compose, geometry, gravity, image, mask, opacity, rotate, tile, x, y
contrast要素
- 概要
- コントラスト処理
- 属性
- sharpen
crop要素
- 概要
- イメージの一部を切り抜く
- 属性
- geometry, height, width, x, y
cycle-colormap要素
- 概要
- (未記入)
- 属性
- display
despeckle要素
- 概要
- スペックルノイズ低減
display要素
- 概要
- イメージを表示
- 備考
- X Serverが動作していないと機能しない
draw要素
- 概要
- テキストや図形を描画
- 属性
- affine, align, antialias, density, encoding, fill, family, font, geometry, gravity, primitive, rotate, scale, skewX, skewY, stretch, stroke, strokewidth, style, text, translate, undercolor, weight, x, y
edge要素
- 概要
- エッジング処理
- 属性
- geometry, radius
emboss要素
- 概要
- エンボス処理
- 属性
- geometry, radius, sigma
enhance要素
- 概要
- (未記入)
equalize要素
- 概要
- 均等化
flatten要素
- 概要
- (未記入)
flip要素
- 概要
- 上下反転
flop要素
- 概要
- 左右反転
frame要素
- 概要
- フレームをつける
- 属性
- compose, fill, geometry, height, inner, outer, width
gamma要素
- 概要
- ガンマ補正
- 属性
- blue, channel, gamma, green, red
get要素
- 概要
- カレントのイメージオブジェクトの幅・高さを取得する
- 属性
- height, width
group要素
- 概要
- 新規グループオブジェクトを作る
- 備考
- 省略可能
image要素
- 概要
- 新規イメージオブジェクトを作る
- 属性
- 共通属性, color
implode要素
- 概要
- 中央に集中点を作る
- 属性
- amount, geometry
label要素
- 概要
- (未記入)
level要素
- 概要
- (未記入)
- 属性
- black, gamma, white
magnify要素
- 概要
- (未記入)
map要素
- 概要
- (未記入)
- 属性
- dither, image
matte-floodfill要素
- 概要
- (未記入)
- 属性
- bordercolor, fuzz, geometry, opacity, x, y
median-filter要素
- 概要
- (未記入)
- 属性
- geometry, radius
minify要素
- 概要
- (未記入)
msl要素
- 概要
- MSLファイルのルート要素
- 備考
- 省略可能
modulate要素
- 概要
- (未記入)
- 属性
- blackness, brightness, factor, hue, lightness, saturation, whiteness
negate要素
- 概要
- 補色に変換
- 属性
- channel, gray
normalize要素
- 概要
- (未記入)
- 属性
- channel
oil-paint要素
- 概要
- 油彩画風にする
- 属性
- geometry, radius
opaque要素
- 概要
- 色を変える
- 属性
- channel, fill, fuzz
print要素
- 概要
- コンソールにメッセージを出力する
- 属性
- output
- 備考
- Windowsのコマンドプロンプトの場合、日本語(マルチバイト文字)は文字化けする
profile要素
- 概要
- (未記入)
quantize要素
- 概要
- (未記入)
- 属性
- colors, colorspace, dither, measure, treedepth
query-font-metrics要素
- 概要
- (未記入)
- 属性
- affine, align, antialias, density, encoding, fill, family, font, geometry, gravity, pointsize, rotate, scale, skewX, skewY, stretch, stroke, strokewidth, style, text, translate, undercolor, weight, x, y
raise要素
- 概要
- 縁の立体化
- 属性
- geometry, height, raise, width
read要素
- 概要
- イメージファイルを読み込む
- 属性
- 共通属性, filename
- 備考
- Windowsのフォルダ区切り文字は \\ とエスケープする必要がある。filenameの値はURLでも良い
reduce-noise要素
- 概要
- ノイズ低減
- 属性
- geometry, radius
repage要素
- 概要
- (未記入)
- 属性
- geometry, height, width, x, y
resample要素
- 概要
- (未記入)
- 属性
- blur, geometry, x-resolution, y-resolution
resize要素
- 概要
- (未記入)
- 属性
- filter, geometry, height, support, width
roll要素
- 概要
- イメージを縦横にずらす
- 属性
- geometry, x, y
rotate要素
- 概要
- 回転させる
- 属性
- degrees, geometry
sample要素
- 概要
- (未記入)
- 属性
- geometry, height, width
scale要素
- 概要
- (未記入)
- 属性
- geometry, height, width
segment要素
- 概要
- セグメント
- 属性
- cluster-threshold, geometry, smoothing-threshold,
set要素
- 概要
- (未記入)
- 属性
- 共通属性, clip-mask, clip-path, colorspace, density, opacity, page
shade要素
- 概要
- 影をつける
- 属性
- azimuth, elevation, geometry, gray
shadow要素
- 概要
- (未記入)
- 属性
- geometry, opacity, sigma, x, y
sharpen要素
- 概要
- (未記入)
- 属性
- radius, sigma
shave要素
- 概要
- (未記入)
- 属性
- geometry, height, width
shear要素
- 概要
- (未記入)
- 属性
- fill, geometry, x, y
signature要素
- 概要
- (未記入)
solarize要素
- 概要
- (未記入)
- 属性
- geometry, threshold
spread要素
- 概要
- 拡散化
- 属性
- geometry, radius
stegano要素
- 概要
- (未記入)
- 属性
- image
stereo要素
- 概要
- (未記入)
- 属性
- image
strip要素
- 概要
- (未記入)
swap要素
- 概要
- (未記入)
- 属性
- indexes
- 備考
- 現在は直前の2つのイメージを入れ替えるのみ。indexes属性は現在使えない
swirl要素
- 概要
- 渦状にする
- 属性
- degrees, geometry
sync要素
- 概要
- (未記入)
threshold要素
- 概要
- 閾値(二値化の際の境界値)を指定
- 属性
- threshold
transparent要素
- 概要
- 指定した色を透過
- 属性
- color
trim要素
- 概要
- (未記入)
write要素
- 概要
- イメージファイルに書き込む
- 属性
- 共通属性, filename
- 備考
- フォルダ区切り文字は \\ とエスケープする必要がある
共通属性
adjoin, alpha, antialias, area-limit, attenuate, authenticate, background, bias, blue-primary, bordercolor, density, fill, filename, gravity, id, magick, mattecolor, pointsize, quality, size, stroke
定義済みプロパティ
意味についてはPerlMagickのGet an Image Attributeを参照。
base, basename, channels, colorspace, copyright, depth, directory, extension, gamma, group, height, input, kurtosis, magick, max, maxima, mean, min, minima, opaque, orientation, output, page, resolution.x, resolution.y, scene, scenes, size, skewness, standard-deviation, type, unique, version, width, xresolution, x-resolution, yresolution, y-resolution
以下の様なMSLファイル(properties.msl)を作成し、
<?xml version="1.0" encoding="utf-8"?> <msl> <print output="base = %[base]\n" /> <print output="basename = %[basename]\n" /> <print output="channels = %[channels]\n" /> <print output="colorspace = %[colorspace]\n" /> <print output="copyright = %[copyright]\n" /> <print output="depth = %[depth]\n" /> <print output="directory = %[directory]\n" /> <print output="extension = %[extension]\n" /> <print output="gamma = %[gamma]\n" /> <print output="group = %[group]\n" /> <print output="height = %[height]\n" /> <print output="input = %[input]\n" /> <print output="kurtosis = %[kurtosis]\n" /> <print output="magick = %[magick]\n" /> <print output="max = %[max]\n" /> <print output="maxima = %[maxima]\n" /> <print output="mean = %[mean]\n" /> <print output="min = %[min]\n" /> <print output="minima = %[minima]\n" /> <print output="opaque = %[opaque]\n" /> <print output="orientation = %[orientation]\n" /> <print output="output = %[output]\n" /> <print output="page = %[page]\n" /> <print output="resolution.x = %[resolution.x]\n" /> <print output="resolution.y = %[resolution.y]\n" /> <print output="scene = %[scene]\n" /> <print output="scenes = %[scenes]\n" /> <print output="size = %[size]\n" /> <print output="skewness = %[skewness]\n" /> <print output="standard-deviation = %[standard-deviation]\n" /> <print output="type = %[type]\n" /> <print output="unique = %[unique]\n" /> <print output="version = %[version]\n" /> <print output="width = %[width]\n" /> <print output="xresolution = %[xresolution]\n" /> <print output="x-resolution = %[x-resolution]\n" /> <print output="yresolution = %[yresolution]\n" /> <print output="y-resolution = %[y-resolution]\n" /> </msl>
コマンドプロンプトで以下のコマンドラインを入力すれば各プロパティのデフォルト値を確認できる。
conjure properties.msl
TIPS
新規画像データを指定の色で塗るには
read要素を使う(凄い違和感だがユーザーコミュニティではこう書かれている…)。
<?xml version="1.0" encoding="utf-8"?> <msl> <image size="640x480"> <read filename="xc:none" /> <write filename="transparent.png" /> </image> </msl>
画像ファイルにコメントを埋め込むには
- commentオプションで埋め込むことが可能。
<?xml version="1.0" encoding="utf-8"?> <!-- comment.msl: JPEG/PNG画像ファイルに同じコメントを埋め込む conjure -comment コメント -SOURCE 画像ファイルパス comment.msl --> <msl> <print output="comment = %[comment]\n" /> <image> <read filename="%[SOURCE]" /> <write filename="comment.jpg" /> </image> <image> <read filename="%[SOURCE]" /> <write filename="comment.png" /> </image> </msl>
小ネタ
画像ファイルを縮小してアプリケーションアイコンファイルを作成
input.pngからマルチアイコンoutput.ico(64x64, 48x48, 32x32, 16x16ピクセル)を作成するコマンドライン。要ImageMagick 6.8.8-3以降。
convert.exe input.png -colors 256 -define icon:auto-resize=64,48,32,16 output.ico
- input.pngは256x256ピクセル以上のサイズであること
- 吉里吉里設定でアプリケーションアイコンを設定することを想定している(256x256ピクセルのアイコンには対応していない模様)
- 「-colors 256」は256色に減色するという意味で省略しても他の値にしても良い