
I'm trying to do this on the Command Line in Linux.
Code: Select all
$ convert -version
Version: ImageMagick 6.7.5-6 2012-08-11 Q16 ...
...
Features: OpenMP
Code: Select all
convert -size 640x640 -alpha set xc:"rgba(0,127,255,0.5)" background.png

Note: Partially transparent image. just what I want.
Code: Select all
convert -size 640x -background "rgb(0,127,255)" -gravity Center -font Nimbus-Sans-Regular -pointsize 18 caption:@text_file.txt foreground.png

Note: Everything is opaque. That's what I want for the text, but not for it's background.
In theory, the next step would be to overlay the two images (the second image on the first) and emit the final image. But since the second image isn't right, I haven't gotten that far.
Most of what I've tried on the second line has generated amusing errors. For example, attempting to put any sort of transparency in the second line results in a black-on-black image. Say, by saying "-background none" or "xc:none" with or without a previous "-alpha set" argument. In fact, anytime the second line adds a canvas (via "xc" at least), then the foreground picture is not emitted, and a "temp-0.png" and "temp-1.png" picture are instead emitted. Attempts to go with modifying the alpha channel in the background (e.g. "-background 'rgba(0,127,255,0.5)'") are ignored, even if "-alpha set" is before it.
To recap: I want to overlay text onto a partially-transparent image and emit as a png file. The background image (semi-transparent blue) works good. The text image (black text from file onto (preferably) straight transparent) does not work. I'm looking for a proper way to generate the text (as fully opaque) for overlay onto the background image. Bonus points if you show the command for the overlay itself. Does not need to be a single line, but that's always nice to have (fewer intermediate temporary files to clean up afterward).