Page 1 of 1

Adding copyright text to an image with ImageMagick7

Posted: 2017-11-09T20:08:40-07:00
by lupacexi
Hi,
I need help in generating copyright text added all over the image at multiple places with Imagemagick 7.

With Imagemagick 6.9 i was able to add copyright text to an image with the below command :
convert -size 240x240 xc:none -fill grey -gravity NorthWest -draw "text 10,10 'Copyright'" -gravity SouthEast -draw "text 5,15 'Copyright'" miff:- | composite -tile - A.jpg ImageMagick6.jpg (Adds copyright text at multiple places.)

But after installing Imagemagick 7 the above command doesn't work. As the composite utility used above is moved to legacy utility.
So instead of using leacacy util i tried using the command as below:
magick convert -size 240x240 -fill grey -gravity NorthWest -draw "text 10,10 'Copyright'" -gravity SouthEast -draw "text 5,15 'Copyright'" A.jpg ImageMagick7.jpg (Adds copyright text only in the NorthWest and SouthEast .)

With the magick command i am unable to use tile and pipeline symbol to repeatedly display the copyright information, as i did in Imagemagick6.

Can you please suggest me an alternative for tile option or usage of tile with the latest Imagemagick 7?

My requirement is to display copyright text all over the image in multiple places with Imagemagick 7. With Image Magick 6 it displays copyright text at multiple places all over the image.

Thank You.

Re: Adding copyright text to an image with ImageMagick7

Posted: 2017-11-09T21:11:35-07:00
by fmw42
Here is the straight conversion of your IM 6 command to IM 7. Note that convert is replace by magick and composite is replaced by magick composite. (Unix syntax)

Code: Select all

magick -size 240x240 xc:none -fill grey \
-gravity NorthWest -draw "text 10,10 'Copyright'" \
-gravity SouthEast -draw "text 5,15 'Copyright'" \
miff:- | magick composite -tile - A.jpg result1.jpg
Here is one way in IM 7 to do it in one magick command line:

Code: Select all

magick -size 240x240 xc:none -fill grey \
-gravity NorthWest -draw "text 10,10 'Copyright'" \
-gravity SouthEast -draw "text 5,15 'Copyright'" \
-write mpr:img +delete \
A.jpg -set option:dim "%wx%h" -size "%[dim]" tile:mpr:img \
-compose over -composite result2.jpg

Re: Adding copyright text to an image with ImageMagick7

Posted: 2017-11-09T21:39:15-07:00
by GeeMack
lupacexi wrote:
2017-11-09T20:08:40-07:00
My requirement is to display copyright text all over the image in multiple places with Imagemagick 7. With Image Magick 6 it displays copyright text at multiple places all over the image.
Here is a very similar command to the one fmw42 offered above...

Code: Select all

magick A.jpg -alpha set -write mpr:input +delete \
   -size 240x240 xc:none -fill grey \
   -gravity NorthWest -annotate +10+10 "Copyright" \
   -gravity SouthEast -annotate +5+15 "Copyright" \
   -write mpr:tiler +delete \
   mpr:input -tile mpr:tiler -draw "color 0,0 reset" \
   mpr:input +swap -composite out.png
That reads in the input image, writes it to a memory register "mpr:input", then deletes the original.

Next it sets the size, background, and fill color, and creates the blank copyright tile.

Then it applies the "Copyright" text to both corners of that 240x240 tile, writes it to a memory register "mpr:tiler", and deletes it.

Then it recalls that "mpr:input" and replaces that image by tiling it over with the "mpr:tiler".

Finally it recalls the "mpr:input" again, swaps places with the tiled version, and composites the one covered with "mpr:tiler" over the "mpr:input".

Name the output file, and it's done.