In Gnome we can create simple scritps to batch process a lot of images.
They are called nautilus scripts and are accesible from the right click mouse button menu in the nautilus windows. But to be seen, a folder must exist with an executable script inside…
(The nautilus is the gnome file explorer, like the explorer in windows and the finder in macOs)
The command we want to repeat for each file is:
~$ convert -crop 400x400+955+510 -normalize infile outfile
this imagemagick command crops the file to a selection and then apply a normalize filter, to gain contrast across the image.
-crop: option to crop the image
400×400 = size of the selected image
+955+510 = coordinates from the upper-left corner of our selection
-normalize: similar to auto-levels, it equalices the image.
Now start by making a simple script to crop and normalize a bunch of images…
Simply, open a terminal and type:
~$ gedit .gnome2/nautilus-scripts/imagemagick/crop-normalize
inside the text editor, copy this piece of code:
fpaths=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
for file in $fpaths
if [ -f "$file" ]; then
convert $file -quality 100 -crop 400x400+955+440 -normalize $base-cn.jpg
save the file and close the gedit.
Now you have a new file in /home/user/.gnome2/nautilus-scripts/imagemagick/ called crop-normalize
and need to activate execution permissions to this script file:
~$ chmod 777 .gnome2/nautilus-scripts/imagemagick/crop-normalize
now you can browse in the nautilus, select one or more images and RIGHTCLICK > scripts > imagemagick > crop-normalize
and then a nice batch procces is made in the background :)
You can look at this screencapture to get an idea about how to set up the numbers in the -crop option. (click to enlarge)
PS: now you also can browse the nautilus-script folder directly, simply with RIGHTCLICK > Scripts > Open script folder and edit again the script with custom settings.