LoginSignup
1
2

More than 5 years have passed since last update.

ImageMagickでの解像度変換

Last updated at Posted at 2015-09-26

ImageMagickを用いて解像度変換を行う方法を記述する。

使用バージョン

  • ImageMagick 6.9.1-4 Q16

convertコマンド

基本的な書式は次の通り。
convert -size 640x400 -depth 8 gray:circle_640x400.raw -filter point -interpolate Nearest -distort Resize 200% -depth 8 gray:circle_1280x800NN.raw

コマンド 入力画像 変換指定 出力画像
convert -size 640x400 -depth 8 gray:circle_640x400.raw -filter point -interpolate Nearest -distort Resize 200% -depth 8 gray:circle_1280x800NN.raw

入力画像指定部

本例では、RAW画像を扱うコマンドとしている。
RAW画像は幅高さ、および1ピクセルあたりの画像深さ情報を持たないため、-sizeオプション、-depthオプションで指定する。
また、画像ファイル名の先頭にgray:を付加する。

変換指定部

-filter point -interpolateで解像度変換方式を指定する。
Nearestの他にも、BilinearBicubicなどを指定できる。
変換後のサイズ指定として、-distort Resizeオプションを使用する。
本例の他、200%x300%などとすると、幅方向と高さ方向とを別々に指定できる。(幅x高さの順で指定する)

1
2
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
1
2