How to annotate text using Xor instead of specific fill color?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dawnsong
Posts: 3
Joined: 2015-12-09T23:17:11-07:00
Authentication code: 1151

How to annotate text using Xor instead of specific fill color?

Post by dawnsong »

How to pass a Xor method instead of fill a solid color to write a text into an image?
With Xor, I don't need consider what background of the image would be, and where I cannot write text.
Thanks a lot.

mogrify -gravity SouthWest -fill Blue -annotate +5+5 "X-Y=z" test.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to annotate text using Xor instead of specific fill color?

Post by fmw42 »

I am not sure I understand what you want. There is no option for -annotate to use Xor. But you can create a text image using label: or caption: and composite it over the background image using -compose Xor.

See
http://www.imagemagick.org/Usage/text/
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/compose/#xor
http://www.magemagick.org/Usage/basics/#mogrify_compose

Please always provide your IM version and platform. See viewtopic.php?f=1&t=9620
dawnsong
Posts: 3
Joined: 2015-12-09T23:17:11-07:00
Authentication code: 1151

Re: How to annotate text using Xor instead of specific fill color?

Post by dawnsong »

Thanks for the confirmation, I cannot find the option of Xor for -annotate, never thought it does not have :)
I will do it with 2 steps.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to annotate text using Xor instead of specific fill color?

Post by fmw42 »

Annotate writes directly onto the image and perhaps is using a -compose over method. But I do not think there is any define to change the -compose method to Xor, though you can try adding -compose Xor to the command line just before -annotate and see if that changes things.
Post Reply