2018-06-13 15:07 阅读 106



I'm interested in creating a similar effect for watermarking images on my site.

I need to generate it on the fly as the text in the middle would be different on each photo, so I can't use a precomposed png file.

I'm not bothered about the exact font (I have one I'm happy with), but how can I go about adding a nicely blurred outline around it like they have?

I tried using gaussianBlurImage but it doesn't work on an ImagickDraw object. Do I need to compose my ImagickDraw onto an Imagick object first, then blur it, then compose it onto the main image?

Or are there some clever ImagickDraw functions I can use that I've not discovered yet?


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    donmqryh49993 donmqryh49993 2018-06-13 20:08

    You can do that in ImageMagick, by creating a transparent background and adding text via label: using black text with a white stroke and then reducing the opacity. Then composite that latter onto your original.


    enter image description here

    convert image.jpg \( -background none -pointsize 64 -fill black -strokewidth 2 -stroke white -font arial -gravity center label:"stockphoto" -channel a -evaluate multiply 0.33 +channel \) -gravity center -geometry +0+50 -compose over -composite result.jpg

    enter image description here

    点赞 评论 复制链接分享