G'Mic Montage

Tags: thunar custom action, g'mic, graphics
November 11, 2015

G'Mic Montage - Thunar Custom Action

To learn how to use Thunar Custom Actions click here.

G’Mic (GreyC’s Image for Magic Computing) is software for image processing that works on Linux, Mac and Windows. It can carry out a zillion functions on images, but I’m just going to focus on its montage tool, which I find superior to ImageMagick’s montage tool. To use the montage feature you must have G’Mic version 1.6.0.4 or above installed.

The montage above was created at the command line with this command:

gmic *jpg -fx_montage 4,\""V(H(0,1),H(2,V(3,4)))"\",1,1.0,0,5,0,0,0,255,0,0,0,0,0 -o output."$(date)".jpg,75

(In earlier versions of G’Mic -gimp_montage was used in place of -fx_montage.)

In a matter of seconds it combined all JPGs in a folder to produce the above montage. Control the quality output by following output.jpg with, say, “,75″ which amounts to 75% quality. I can’t get the quality output function to work with my command for Thunar Custom Actions. So when creating montages with Thunar Custom Actions you’ll need to reconvert the output montage to smaller quality, unless you don’t mind a large filesize.

This part of the command:

\""V(H(0,1),H(2,V(3,4)))"\"

controls the layout of the images. I haven’t quite figured this out yet, but I like the way it lays out images, so I use it as my default. (You can use this tutorial to learn about possible commands using G’Mic plugin for GIMP in verbose mode. I used this tutorial to figure out what default command I like best.)

This part of the command:

,1,1.0,0,5,0,0,0,255,0,0,0,0,0

has 13 values between commas representing different options.

With this custom action you can right-click on selected JPGs and select the G’Mic Thunar Custom Action, which will automatically convert the images into a montage with 5px borders. An improvement on this command could be achieved with the incorporation of YAD, which would give you the option to input all sorts of variations in framing size, padding, rotation, colors, montage size. But I like this command for most uses, so I use it as my default. To learn more about Thunar Custom Actions click here. With the command-line version of the command the quality output can be controlled by following output.”$(date)”.jpg with, say, “,75″ which amounts to 75% quality. I can’t get the quality output function to work with the command for Thunar Custom Actions. So when creating montages with Thunar Custom Actions you’ll need to reconvert the output montage to smaller quality, unless you don’t mind a large filesize.

gmic %N -fx_montage 4,\""V(H(0,1),H(2,V(3,4)))"\",1,1.0,0,5,0,0,0,255,0,0,0,0,0 -o 0000."$(date)".jpg

Under Appearance Conditions check Image Files.

##Thunar Custom Action – Create Montage of Directory Contents

This Custom Action works if you have a directory of images you want to make into a montage. Just right-click on the folder housing the images and click G’Mic Montage Folder Content. The montage will be saved within the respective folder (this works on multiple folders, though the system may freeze up if you run it on too many folders at once). The script currently works only with JPGs, but it can be modified to work with additional formats. With the command-line version of the command the quality output can be controlled by following output.”$(date)”.jpg with, say, “,75″ which amounts to 75% quality. I can’t get the quality output function to work with the command for Thunar Custom Actions. So when creating montages with Thunar Custom Actions you’ll need to reconvert the output montage to smaller quality, unless you don’t mind a large filesize. NOTE: Will not work on images with spaces in filenames. The Custom Actions here are good for removing spaces and other characters from filenames.

/$USER/Scripts/montagefolders.sh %F

Under Appears if selection contains make sure Directories and Image Files are checked.

Change $USER/Scripts/montagefolders.sh to the path of the bash script, and change montagefolders.sh to the name you give the bash script.

###Bash Script:

I keep my bash scripts in a folder called “Scripts” in my personal directory. To create the bash script copy the script below and paste it into a text editor. Name the script montagefolders.sh and save it to the scripts folder you created. Make the script executable by opening up a terminal and navigating to the folder in which the script is stored. Type chmod +x montagefolders.sh and press Enter. The script will now work when used with Thunar Custom Actions.

Bash Script

##Thunar Custom Action - Create Multiple Montages of Images in Folder

This G’Mic script will go through a folder of many images and output multiple montages in the working folder. The script can be modified to customize the number of images to turn into individual montages by changing the 4 in (expr $c % 4) to whatever number desired. NOTE: Will not work on images with spaces in filenames. The Custom Actions here are good for removing spaces and other characters from filenames.

/$USER/Scripts/gmicmultiplemontages.sh %N

###Bash Script:

I keep my bash scripts in a folder called “Scripts” in my personal directory. To create the bash script copy the script below and paste it into a text editor. Name the script gmicmultiplemontages.sh and save it to the scripts folder you created. Make the script executable by opening up a terminal and navigating to the folder in which the script is stored. Type chmod +x gmicmultiplemontages.sh and press Enter. The script will now work when used with Thunar Custom Actions.

Bash Script

}