Search code examples
imageimagemagickimagemagick-convert

ImageMagick - Add Transparent / Semi Transparent text watermark on Image


I need to create resized, lower quality image with transparent/semi transparent WHITE txt watermark. As i`m not imagemagic expert i already do my researches and get to point of following command:

magick.exe "C:\Test\Test.tif" -resize 800x -quality 60% -set 'option:size' '%[fx:w*0.5]x%[fx:h*0.5]' -pointsize 285 -font Arial -background none -fill rgba(255,255,255,0.5) -gravity center -annotate +0+0 "TEST" "C:\Test\Test1.Tiff"

I have made test on like 10 different source images, with different orientation, colour, black&white etc. Is working fine for almost all of them. Unfortunetly it needs to work for all not "almost all". In some cases resize, watermark position is all good, however... watermark is transparent grey instead of white... Thought issue is with background but even if set it to white, same thing. Hitting wall with that atm, would massivly appreciate any help. Attaching excample output that i`m looking forenter image description here

As per description, played with RGB codes, (check many different configs for it with same results) Tried reorganise order of params as read is also important, but without luck as well. Checked different commands as well but one that i`ve paste here is what i need, despite issue with txt colour.


Solution

  • You can do that as follows in Imagemagick. Create a black image with your text the same size as the input. Then compose plus with the input.

    IM 7 Unix syntax:

    Input:

    enter image description here

    magick lena.jpg \
    \( +clone -fill black -colorize 100 \
    -fill "gray(35%)" -gravity center -font arial-bold -pointsize 64 -annotate +0+0 "TEXT" \) \
    -compose plus -composite \
    lena_text.jpg
    

    enter image description here