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.
annotating images with complementary coloured text
Re: annotating images with complementary coloured text
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.
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.
- 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
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.
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.
Re: annotating images with complementary coloured text
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
You may be able to modify that; I converted it to php: http://www.rubblewebs.co.uk/imagemagick ... example=72
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: annotating images with complementary coloured text
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
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/
https://imagemagick.org/Usage/