Linux Mint Cinnamon Context Menu

Sometimes you just need to add your item there ...

Page content

Cropping, resizing and making borders to the images for this blog pushed me to add this frequently used feature to Linux Mint Cinnamon’s context menu.

As I described in the Mainroad image handling post, I needed quite specific image resolutions.

Nemo context nenues for images

When

Installing nemo-image-converter package adds Resize Images… context menu for image files.

Resize image props

But to me it is missing

  • crop feature
  • border feature
  • inamility to remember other then standard resolutions

So I added Cut 11:8 & resize… context menu.

Where

In folder ~/.local/share/nemo/actions Cinnamon is picking up action definitions. Navigate to this folder with Nemo and you will see More Info button.

Standard predefined Cinnamon context menu actions are located in /usr/local/nemo/actions folder.

How

Put into the file conv.sh our cutting and resizing script

nano ~/.local/share/nemo/actions/conv.sh

Script:

#!/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 

Make it executable

chmod +x ~/.local/share/nemo/actions/conv.sh

Add action definition

nano ~/.local/share/nemo/actions/cut-n-resize.nemo_action

Put the following text in

[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;

You might need to restart the Cinnamon…

That’s all Folks!