I am trying to create a file with a transparent background and transparent text. I would like to have the text white but have it be a tranparency of 35%. I have tried a lot of things and I can't seem to be able to get it to work. Below is where I am at. I am using label because I don't know what the final dimensions are going to be. Thanks for the help.
convert -background transparent -fill "rgb(255,255,255)" -gravity West -font arial.ttf'
-pointsize 20 label:"This is a test" -background transparent -flatten -trim +repage testFile.png
How do I create transparent text
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How do I create transparent text
As we are trimming, gravity is superfluous. With transparent black background, and opaque White letters, we can multply all alpha values by 0.35 to make the letters semi-transparent:
An alternative, perhaps more elegant and quicker, is to specify the RGBA of the letters:
Note that alpha is specified here as a fraction.
Code: Select all
convert -background transparent -fill White -font arial.ttf -pointsize 20 label:"This is a test" -channel alpha -evaluate multiply 0.35 -trim +repage testFile.png
Code: Select all
convert -background transparent -fill rgba(255,255,255,0.35) -font arial.ttf -pointsize 20 label:"This is a test" -trim +repage testFile.png
snibgo's IM pages: im.snibgo.com