annotating images with complementary coloured text

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
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

annotating images with complementary coloured text

Post by manit »

Is it possible to write a word over image in such a way that colour of letter is complementary to background.
The colour of every pixel (that will be superimposed by text) should be complementary to average of 8 pixels surrounding it in original image.
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

Re: annotating images with complementary coloured text

Post by manit »

Seems the one I mentioned above will require scrutiny to decide colour of every pixel of text .
That would be complicated.
If I have a monospaced font and I know fontsize then can I calculate the area (in pixels) that text will occupy ?
Then I wish to calculate average colour of that area . Then put the complementary colour as fill colour of font .

Recently , I was watching movie and I noticed that white font over snowy background seemed improper. SO I want to write over pictures with complementary colour. Later , it would be great if I could make an app that could overlay video with subtitles of desired colour . In realtime , it would be difficult but creating customised subtitles after analysing frames of video would be less hard.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: annotating images with complementary coloured text

Post by fmw42 »

Usually subtitles have an undercolor color and the text is complementary to the undercolor. It makes it easier to read that way.

I wrote a script, autolabel and autocaption, that looks for some constant region and puts text in that region. The text can be complementary black on white or white on black. But it is not character by character. That would be hard to do and also hard to read.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: annotating images with complementary coloured text

Post by Bonzo »

whugemann wrote some code to use either black or white and I think this is the thread: viewtopic.php?f=1&t=18788

You may be able to modify that; I converted it to php: http://www.rubblewebs.co.uk/imagemagick ... example=72
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: annotating images with complementary coloured text

Post by anthony »

The problem with complementary colors, is that the complement of grey is.... grey!!!

Not very useful!

That is why undercolor of some type is used. either a box, or a outline, either opaque or semi-transparent.

See Annotating Images, Labeling on top of the Image itself...
http://www.imagemagick.org/Usage/annotating/#anno_on
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply