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

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

报告相同问题?

悬赏问题

  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备