LoginSignup
3
1

More than 5 years have passed since last update.

Windows + ImageMagick > はまり > convertコマンドを使おうとして失敗 > Windowsにもあるコマンド

Last updated at Posted at 2018-12-19
動作環境
Windows 7 pro(32bit)

エラー

とある公式ツールがメモリエラーでまともに動かないため、ImageMagickで処理をしようとした。

.NEFファイルを.jpgへ変換するという作業。

  1. Git bashをインストール
  2. ImageMagickをインストール
  3. bashスクリプトを実装
loop_conv_181219_exec
#/usr/bin/env bash

for afile in $(ls *.nef);do
  tofile=$(echo $afile | sed s'/nef/jpg/g')
  echo $afile $tofile
  convert $afile -quality 100% $tofile
#  exit # for test
done

実行をしようとすると

$bash loop_conv_181219_exec
Invalid parameter: XXX.jpg

理由

Windows自体にconvertコマンドがあるようだ。

下記に詳しい。
https://stackoverflow.com/questions/3060205/error-invalid-parameter-fom-imagemagick-convert-on-windows

convert is also the name of a windows executable which converts FAT filesystem to NTFS.

convertコマンドでなく、magickコマンドで引数をconvertとする、とも上記リンク先に記載がある。

パス指定の方法で対処したところ、うまく動いた。

loop_conv_181219_exec
#/usr/bin/env bash

for afile in $(ls *.nef);do
  tofile=$(echo $afile | sed s'/nef/jpg/g')
  echo $afile $tofile
  "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert $afile -quality 100% $tofile
#  exit # for test
done
3
1
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
3
1