79564862

Date: 2025-04-09 16:38:16
Score: 0.5
Natty:
Report link

Based on the answer of StackExchange saddens dancek, I have made a short function to watermark an image from text

Within ~/.zshrc, adding :

watermark() {
    if [[ "$1" == "" ]]; then
        echo "Error: Watermark text and file missing" >& 2
        echo "Usage: $0 <watermark> <file>" >& 2
        return 1
    elif [[ "$2" == "" ]]; then
        echo "Error: File missing" >& 2
        echo "Usage: $0 <watermark> <file>" >& 2
        return 1
    fi
    magick -size 260x120 xc:none -fill grey \
          -gravity NorthWest -draw "translate 10,10 rotate -15 text 10,10 '$1'" \
          -gravity SouthEast -draw "translate 10,10 rotate -15 text 5,15 '$1'" \
          miff:- | \
        magick composite -tile - "$2" "wmark-$2"
    echo "Output: wmark-$2"
}

Example:

$ watermark "My watermark" image.png

Expected output:

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Eternal Dreamer