Page 1 of 1

Full opacity text on top of 50% opacity solid black

Posted: 2014-02-18T16:25:51-07:00
by gouldtv
I'm having trouble with my "ordering", and I could use a second pair of eyes to tell me what I'm doing wrong please....


What I want to do is overlay a text element as _pure white_, and have THAT overlay on top of a solid black rectangle at 50% opacity, and have THAT overlay on top of an image. As you can see from the below command-line code, I've got it almost working, but as you can see, it puts a blend of 50% on _everything_.

convert http://o.aolcdn.com/dims-shared/dims3/G ... 80_350.jpg \( -background black -alpha on -size 356x -fill white \ -font Helvetica label:"Craigslist Killer: How Many Victims?" \) \ -gravity south -compose blend -define compose:args=50 over -composite output.jpg

Can someone give me some pointers on doing 3 things to this?

1) Make the blend so that the black background is 50% opacity, but the white text is 100% opaque
2) Make it so that no matter how long the text string, the font-size will remain consistent.
3) Add a padding to the bottom of the text-area so that it has about 10 pixels underneath the text, (but the black-background at 50% is still pegged at the bottom - - - making the black background taller in other words)

Re: Full opacity text on top of 50% opacity solid black

Posted: 2014-02-18T16:55:29-07:00
by fmw42
I am not sure what you mean by the text area having 10 pixels below? I have raised the text area by 10 pixels vertically.

But give this a try and then explain what you want different. This is on an older IM 6.8.0.5 and results may differ on other versions. What version of IM and platform?

Code: Select all

convert 6_980_350.jpg \
\( +clone -fill "rgba(0,0,0,0.5)" -colorize 100 \) \
-compose over -composite \
\( +clone -fill none -colorize 100 -fill white -gravity center \
-pointsize 20 -annotate +0-10 "Craigslist Killer: How Many Victims?" \) \
-compose over -composite result.jpg
Note if your pointsize is too large for the width of the image, it will be clipped at the ends.

Re: Full opacity text on top of 50% opacity solid black

Posted: 2014-02-18T20:01:49-07:00
by gouldtv
Well, I wish I had better news, but that call just covered the whole image with a black background with white text:

convert http://o.aolcdn.com/dims-shared/dims3/G ... 80_350.jpg \ \( +clone -fill "rgba(0,0,0,0.8)" -colorize 100 \) \ -compose over -composite \ \( +clone -fill none -colorize 100 -fill white -gravity center \ -pointsize 20 -annotate +0-10 "Iran Draws Red Line on Nuclear Deal" \) \ -compose over -composite output.jpg

I am running the IM that comes with Dreamhost.com (and for whatever reason, Dreamhost doesn't surface the version # in their control panel)

Re: Full opacity text on top of 50% opacity solid black

Posted: 2014-02-18T20:31:49-07:00
by fmw42
convert http://o.aolcdn.com/dims-shared/dims3/G ... 80_350.jpg \ \( +clone -fill "rgba(0,0,0,0." -colorize 100 \) \ -compose over -composite \ \( +clone -fill none -colorize 100 -fill white -gravity center \ -pointsize 20 -annotate +0-10 "Iran Draws Red Line on Nuclear Deal" \) \ -compose over -composite output.jpg
Is this one line? \ at the end of a line must not have any characters or spaces after them and must continue on the next line.

Try with a local image and see if that works. If not, then something is either limited by your 3rd party software or a very old version of IM. It works just fine for me on command line IM on Mac OSX with IM 6.8.0.5, which is not very current, even with your http: access image. Perhaps your 3rd party system cannot handle images over the web?

try putting

convert -version

into your system and see what it returns for the version.


Perhaps your 3rd party system does not allow multi-line commands. So take out all the end of line \ and make it one long command, such as

Code: Select all

convert http://o.aolcdn.com/dims-shared/dims3/GLOB/crop/+283/resize/410x179/format/jpg/http://at.on.aol.com/slots/-999/3_980_350.jpg \( +clone -fill "rgba(0,0,0,0.5)" -colorize 100 \) -compose over -composite \( +clone -fill none -colorize 100 -fill white -gravity center -pointsize 20 -annotate +0-10 "Craigslist Killer: How Many Victims?" \) -compose over -composite result.jpg