[SOLVED]: IM6, Pango, creating text overlays
Posted: 2018-10-05T03:21:11-07:00
ImageMagick 6.9.10-13 Q16 i686 (Linux, 32bit)
I'm trying to overlay text onto existing images.
Each text is unique and <= 402 characters, each image is also unique and are frequently different geometries (rarely bigger than 500x500), and can be colour or monochrome, with a variety of predominant colours or tones.
I want the text to be as visible as possible on each image as the final composite images will be uploaded to social media programmatically (I'm using Python3). There are about 3500 images to deal with.
I'm using pango because it seemed the easiest way to wrap text to lots of different sized images.
So far I've got close to what I want by creating an "overlay" with the text, and compositing that over an existing image, as follows:
(I'm actually passing the values for -size and the pango text from variables, and the text is pango'd to set font & size using PML)
Example of my output here.
As you can see, this is not entirely satisfactory. I don't in truth really understand graphics and image structures at all well, so I'd like some help.
I'd like the text to be a single solid black or white, and to be able to vary that based on whether the underlying image is broadly light or dark. I realise that this means not every final image is going to perfect.
Hope I've been clear
I'm trying to overlay text onto existing images.
Each text is unique and <= 402 characters, each image is also unique and are frequently different geometries (rarely bigger than 500x500), and can be colour or monochrome, with a variety of predominant colours or tones.
I want the text to be as visible as possible on each image as the final composite images will be uploaded to social media programmatically (I'm using Python3). There are about 3500 images to deal with.
I'm using pango because it seemed the easiest way to wrap text to lots of different sized images.
So far I've got close to what I want by creating an "overlay" with the text, and compositing that over an existing image, as follows:
Code: Select all
convert -define pango:wrap=word -background white -transparent white -size www x hhh pango:"some text here up to 400ch" overlay.png
composite overlay.png image.png final_image.png
Example of my output here.
As you can see, this is not entirely satisfactory. I don't in truth really understand graphics and image structures at all well, so I'd like some help.
I'd like the text to be a single solid black or white, and to be able to vary that based on whether the underlying image is broadly light or dark. I realise that this means not every final image is going to perfect.
Hope I've been clear