![]() ![]() When I apply the mask by combining the images, any grey shades found in $mask as a result of anti-aliasing will be semi-transparent and result in smoother edges. The first image $watermark is grey-scale, and the second image $mask uses pure black for the parts I want to be transparent and white for the parts I want to keep. Several images are created in this example. $image->compositeImage($watermark, Imagick::COMPOSITE_DISSOLVE, 0, 0) ![]() $watermark->compositeImage($mask, Imagick::COMPOSITE_COPYOPACITY, 0, 0) $watermark->annotateImage($draw, 10, 12, 0, $text) Position text at the bottom right of the image $mask->newImage($width, $height, new ImagickPixel('black')) $watermark->newImage($width, $height, new ImagickPixel('gre圓0')) gravity center -draw "fill grey70 text 0,0 'Copyright'"Ĭonvert -size 300x50 xc:black -font Arial -pointsize 20 -gravity centerĬomposite -compose CopyOpacity mask.png fgnd.png stamp.pngĬomposite -gravity south -geometry +0+10 stamp.png image.png But while this works, the text stands out too drastically from the image and the effect should probably be more subtle.įor a smoother effect on the watermark text, you can make the text string transparent using a font mask.Ĭommand line example: convert -size 300x50 xc:gre圓0 -font Arial -pointsize 20 This example is pretty straight-forward and the code’s comments make it so you shouldn’t need much extra explanation. Draw text again slightly offset with a different color $draw->setGravity(Imagick::GRAVITY_SOUTHEAST) ![]() Position text at the bottom-right of the image The command line example is: convert image.png -font Arial -pointsize 20Īnd the PHP equivalent is: setFont('Arial') The easiest type of textual watermark to create is a string overlay on top of the image. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |