Hello,
How to make negated label? I give you an example:
Thank you!
Negated Text?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Negated Text?
No easy solution that I know about. Best I can think is to make the image twice, once with each text color. Then make a mask with the center horizontal band white and the rest black. Then use the mask to composite the two versions together so that the center uses the image with one text color and the rest of the image comes from the other text color.
see
http://www.imagemagick.org/Usage/compose/
http://www.imagemagick.org/Usage/channels/#masks
see
http://www.imagemagick.org/Usage/compose/
http://www.imagemagick.org/Usage/channels/#masks
Re: Negated Text?
Before posting I tried this:
With GIMP create mask.png file with transparent background.
After that:
But result.jpg is just negated image.jpg.
fmw42 I'm not sure that I understand you correctly. Can you give example commands, please!
With GIMP create mask.png file with transparent background.
After that:
Code: Select all
convert mask.png matte:- | convert - -negate mask2.png
convert mask2.png -fill white -pointsize 45 -draw "rotate -30 gravity Center fill white text 0,0 'Negated Text' " +matte mask3.png
composite -compose CopyOpacity mask3.png image.jpg stamp.png
convert stamp.png -negate negated_stamp.png
composite -gravity center image.jpg negated_stamp.png result.jpg
fmw42 I'm not sure that I understand you correctly. Can you give example commands, please!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Negated Text?
Here is an example, but it may not be the most efficient. But it works.fmw42 I'm not sure that I understand you correctly. Can you give example commands, please!
# create background
convert -size 500x100 xc:dodgerblue \
-gravity center -background gold -extent 500x300 text_bg.png
# create mask from background
convert text_bg.png -channel blue -separate +channel -threshold 0 text_mask.png
http://www.fmwconcepts.com/misc_tests/t ... t_mask.png
# create text with first color on transparent background
convert -background none -font Candice -pointsize 60 -fill black \
label:'Test Contrast Text' \
-rotate 25 -gravity center -extent 500x300 text1.png
# create text with second color on transparent background
convert -background none -font Candice -pointsize 60 -fill wheat \
label:'Test Contrast Text' \
-rotate 25 -gravity center -extent 500x300 text2.png
# composite both text colors with mask
convert text1.png text2.png text_mask.png -compose over -composite text3.png
# overlay composited text onto background
convert text_bg.png text3.png -compose over -composite text_final.png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Negated Text?
A -compose difference with a black and white mask will selectively negate the other image according to that mask. You can also try using the relatated compose method 'exclusive'.
See IM Examples, Compose, Difference
http://www.imagemagick.org/Usage/compose/#difference
See IM Examples, Compose, Difference
http://www.imagemagick.org/Usage/compose/#difference
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Negated Text?
I see where is my mistake. The last command from my previous post must be
and it works. Thank you fmw42!
works too and must be much more efficient.
Thank you anthony!
Code: Select all
convert image.jpg negated_stamp.png -compose over -composite result.jpg
Code: Select all
composite mask3.png image.jpg -gravity center -compose difference result.jpg
Thank you anthony!