0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ディレクトリ内のsvgファイルをすべて垂直反転するコマンド

0
Posted at
for f in *.svg
do
inkscape --actions="file-open:$f;select-all;object-flip-vertical;export-filename:fliped-$f;export-do;"
done

どういうことか説明します.

動作説明

for f in *.svg

変数$fに,カレントディレクトリのsvgファイルを代入しつつループします.

inkscape --actions="file-open:$f;select-all;object-flip-vertical;export-filename:fliped-$f;export-do;"

InkscapeにはActionsというスクリプト的なものを実行する機能があります.--help曰く,--actions=ACTION(:ARG)[;ACTION(:ARG)]*の形で指定します.つまり,

[命令]:[引数];[命令2]:[引数];...

の形です.引数に指定できるものはヘルプで見つからなかったのでカンで頑張って探しました.

file-open:[FILE_NAME];

ファイルを開きます.

select-all;

画像を全選択します(GUIの操作をコマンドラインでやるイメージ).

object-flip-vertical;

先ほど選んだ範囲を垂直反転します.

export-filename:fliped-$f;export-do;

出力ファイル名を設定したあとにエクスポートします.

完成!

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?