Here’s some test scripts for anyone who’s watching, and wants to use this with digikam or on the command line. And I can’t thank the devs enough for their work here…
Starting work on the commandline
Firstly, I wrote a little script that I could call from both the Linux commandline, or from digikam (or from anywhere else from that matter, so that I could run a few different variations automatically. It’s in a file called “/home/USER/gmicafre” (original, eh! ) where USER is my username on that computer.
I put the following lines in it:
#!/bin/bash
gmic "$1" fx_inpaint_holes 4,12,0 afre_cleanphoto 5,10,0,1 fx_tk_colortemp 0,1 o. {f}/{b}_afreclean_holes_temp.jpg,88
gmic "$1" fx_inpaint_holes 4,12,0 afre_cleanphoto 5,10,0,1 o. {f}/{b}_afreclean_holes.jpg,88
gmic "$1" afre_cleanphoto 5,10,0,1 o. {f}/{b}_afreclean.jpg,88
Let’s go through what it does. It runs the gmic process a few times, producing different outputs each time. I’ll keep to the first gmic line, as the other gmic lines do the same kind of thing but applying fewer filters to their output.
On each of the gmic lines:
- “$1” takes the first argument supplied with the script name - it is the photo image you want to process, and includes the full path with that photo filename.
- fx_inpaint_holes, afre_cleanphoto and fx_tk_colortemp are each filters that are applied to the photo. The numbers that come after each filter are generally the default numbers that the programmer (@afre) recommends, though I have changed one or two of them after a few extra tests.
- The output image is written using the “o.” command, which puts the output into the same directory (using {f}) and giving it the same base name, but appending some info about what each of the filters it has applied are.
- Finally, the “,88” (which only works for jpg images) tells gmic to output with 88% quality, which gives me an image of about the same size as the input image. Yes, this reduces the quality a bit, but the images are still relatively pleasing to the eye. If you want to lose the least information, and you can handle a fairly large file size, using “.png” rather than “.jpg,88” might be a better idea.
After issuing
gmic update
in the commandline to make sure I had the latest filter definitions, the way I ran this script on a host of files was to issue the following command:
find /ROOT DIRECTORY OF IMAGES TO BE PROCESSED/ -iname "img*.jpg" -exec sh gmicafre "{}" \;
Of course, you’ll replace the uppercase stuff with your own directory. And this works on Linux shells only.
The script will create three images from the source image, and you can go through and see which variations suit your source images. You can delete unnecessary images or go and edit the original script so it only creates images with the filters you choose. And, of course you can use many tens of different filters as you like.
Digikam
Digikam is another program I adore. I select the images (or whole albums I want to run this on in the digikam main window and press Shift + B. That takes me to the batch queue manager and instantly lists all photos I selected in the Queue pane to the left of the window.
I then go down to the Control Panel, scroll down to the last item in the list (User Shell Script) and double-click on that.
I then move over to the Tool Settings pane, and in the Shell Script box, I type:
/home/USER/gmicafre $INPUT
Then I go to the top left of the batch queue manager window and hit the Run button.
Don’t be concerned by the error messages that come up in the Queues pane. Your images will be created. Once all images are processed, close the Batch Queue Manager window, return to Digikam’s main window, and hit F5 to refresh the screen. You’ll see your new images there and can scroll through them in preview mode to see how your various filters have been applied.