Linux Mint Cinnamon コンテキストメニュー
ときどき、ただその場所にアイテムを追加するだけで済みます...
目次
このブログの画像をトリミングし、リサイズし、境界線を追加する作業は、Linux Mint Cinnamonのコンテキストメニューにこの頻繁に使用される機能を追加するきっかけとなりました。
Mainroad画像処理投稿で説明したように、私はかなり特定の画像解像度が必要でした。
いつ
nemo-image-converterパッケージをインストールすると、画像ファイルに対して「Resize Images…」というコンテキストメニューが追加されます。
しかし、私にとっては以下の機能が不足しています。
- トリミング機能
- 境界線機能
- 標準以外の解像度を記憶する機能
そのため、私は「Cut 11:8 & resize…」というコンテキストメニューを追加しました。
どこで
フォルダ ~/.local/share/nemo/actions
に配置されたアクション定義は、Cinnamonが読み取っています。
Nemoを使ってこのフォルダに移動し、そこに「More Info」ボタンがあることに気づくでしょう。
標準的なCinnamonコンテキストメニューのアクションは、/usr/local/nemo/actions
フォルダに配置されています。
どうやって
ファイル conv.sh にトリミングとリサイズのスクリプトを追加
nano ~/.local/share/nemo/actions/conv.sh
スクリプト:
#!/bin/sh
fullfname=$1
convert $1 -gravity center -quality 99 -extent 11:8 1.jpg
convert 1.jpg -resize 676x493 -quality 80 -interlace plane -border 1x1 ${fullfname%.*}_w678.jpg
convert 1.jpg -resize 233x169 -quality 80 -interlace plane -border 1x1 ${fullfname%.*}_w235.jpg
実行可能にします
chmod +x ~/.local/share/nemo/actions/conv.sh
アクション定義を追加
nano ~/.local/share/nemo/actions/cut-n-resize.nemo_action
以下のテキストを入力します
[Nemo Action]
Active=true
Name=Cut 11:8 & resize w235 & w678
Comment=Cut 11:8 and resize to w235 and w678 %N
Exec=<conv.sh %F>
Icon-Name=folder
Selection=s
Extensions=jpg;png;
Cinnamonを再起動する必要があるかもしれません。
以上です。皆様、どうもありがとうございました!