Hello Friends!
Help me with command...
How can determine the color of a particular selected area in the picture, so that later i can insert a watermark depending on the background color. If the color background is light, then insert a black watermark. Or if the background color is black, then insert the lighter!
Some examples:
Thank you so much!
Watermark color depending on the background
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Watermark color depending on the background
What version of IM, on what platform?
The basic idea is to crop the desired rectangle, and find the average lightness. If this is less than 50% (or whatever threshold you want) the text will be white, otherwise black.
With v7 this can probably be done in one command. In v6 it will need a shell script.
The basic idea is to crop the desired rectangle, and find the average lightness. If this is less than 50% (or whatever threshold you want) the text will be white, otherwise black.
With v7 this can probably be done in one command. In v6 it will need a shell script.
snibgo's IM pages: im.snibgo.com
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Watermark color depending on the background
For example, bash syntax:
For the fill in the command that annotates or labels the image, use:
Code: Select all
PERCENT=$(convert \
toes.png \
-gravity East \
-crop 40x200+0+0 +repage \
-format "%[fx:mean<0.5?100:0]" \
info:)
Code: Select all
-fill "gray($PERCENT%)"
snibgo's IM pages: im.snibgo.com