打水印时主要用的是PHP扩展ImageMagick,该扩展专门用于处理图片,功能丰富,使用灵活,详细介绍可参看官方文档.php
项目中用到的主要在upfile里,有打水印、裁剪、划线、画矩形、格式转换等。其中打水印命令最为复杂,下面对其中的参数和选项作个梳理。测试
convert +profile '*' source -quality 80 -resize '800x600' water.png -gravity southeast -geometry +0+0 -composite -fill rgba\(255,255,255,0.35\) -font fzltchjt.TTF -pointsize 20 -stroke rgba\(0,0,0,0.22\) -strokewidth 1 -gravity SouthEast -draw "text 28,15 '贴图ID:188916'" dest
+profile profile_name
to remove the indicated profile.测试过部分参数,不知道理解的对不对,原参数实在太多了 -_-||字体