dpg78570 2018-06-13 15:07
浏览 219
已采纳

如何使用ImageMagick实现这种模糊的文本轮廓效果?

https://thumb7.shutterstock.com/display_pic_with_logo/1517996/1106095757/stock-photo-photographer-silhouette-people-make-a-photo-of-nature-landscape-for-photostocks-and-social-networks-1106095757.jpg

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?

Thanks

  • 写回答

1条回答 默认 最新

  • 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.

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)