Learning BASH 6
In my previous post I wrote about creating a menu system using whiptail. This time I am going to write about a different topic entirely.
If you create lots of media such as photos or graphics. You may want to add information pertaining to the copyright (or ideally copyleft) of the image. As I am interested in Creative Commons (CC) then it makes sense to be able to add one of the many creative commons license logos to an image.
I have in the past attempted to do this. I asked on Friendica about how to do this and was provided with some help and a really useful shell script to automate the process.
Firstly we need an image to modify and a logo image to add to this:
Example logo file to insert
For the sake of this article I am just using a random photo I took of Paignton Geopark. I have also reduced the image size to 640×480 to make it smaller for the website as per command below.
gm mogrify -resize 640×480 *.JPG
The next step is to create a folder structure to contain what we need to undertake the work.
What we need is a new folder
Inside this, we need another folder called out
we need some more files mostly the cc logos, these are available from a simple duckduckgo search.
So what we should have is
Put the SOURCE FILE in \insertcc-logo\
MODIFY AND RUN the script below
Our script looks like ( save this as insertcc.sh or what you want to call this )
for p in *.JPG; do convert “$p” ./out/88×31.png -gravity southeast -geometry +10+10 -composite “out/$p”; done
What the script does is take each file with the JPG extension (or other extension), add the required logo, and save the modified file in
As per :
You need to make sure that the script points to the correct source files.
You also need to point the script to the correct file you want to insert in to your source image.
for p in *.JPG;
To use a different logo change this section of the script
Hope this helps
Please feel free to discuss further on friendi.ca