Search code examples
pythonimagemagickwatermark

How to create a watermark aligned at an angle?



Is it possible to draw such watermarks aligned at an angle using Python or Imagemagick ?

Source


Update in July 5 2022 AM :

magick convert input.jpg -gravity center -alpha set -background none ( -pointsize 14 -fill #ffffff64 -size 120x45 label:"SAMPLE TEXT" -write mpr:tile +delete ) ( -clone 0 -resize 200% -colorize 100 -tile mpr:tile -draw "color 0,0 reset" -rotate 40 ) -composite output.jpg

Solution

  • In Imagemagick 6, you can do the following. Create an image of the watermark text at the desired angle and color and opacity. Then tile that out to fill the size of the input. The composite the tiled watermark over the input.

    Input:

    enter image description here

    convert \
    -background None -fill "#fff7" \
    -pointsize 20 label:"Watermark" \
    -rotate -40 +repage \
    +write mpr:TILE +delete \
    barn.jpg -alpha set \
    \( +clone -fill mpr:TILE -draw "color 0,0 reset" \) \
    -compose over -composite \
    barn_watermarked.jpg
    

    enter image description here

    If on Imagemagick 7, change convert to magick.