Created
October 26, 2023 14:31
-
-
Save kkroesch/984580c87d6b3ce4789e4e82577bef76 to your computer and use it in GitHub Desktop.
Put a copyright notice on JPEG pictures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| COPYRIGHT="© Karsten Kroesch - www.kroesch.ch" | |
| for file in *.jpeg | |
| do | |
| # Get the height of the image | |
| height=$(identify -format "%h" "$file") | |
| # Calculate the pointsize as 5% of the image height | |
| pointsize=$(echo "scale=0; $height * 0.05 / 1" | bc) | |
| # If pointsize is zero, set a minimum pointsize (e.g., 10) | |
| if [ "$pointsize" -eq 0 ]; then | |
| pointsize=20 | |
| fi | |
| convert "$file" \( -background none -font Arial -pointsize "$pointsize" \ | |
| -fill white -stroke black -strokewidth 1 \ | |
| -gravity southeast -annotate +10+10 "$COPYRIGHT" \) \ | |
| "$file" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment