Skip to content Skip to sidebar Skip to footer

Check Visibility (contrast?) Between Text Image With Transparency On Top Of Background Image

I have two images: one with colored text and transparent background and another with a random background (could be anything...solid color, photo, painting, etc). Basically I would

Solution 1:

The classic technique is to draw a "dim box" behind the text like this:

enter image description here

as described by Anthony Thyssen in his excellent tutorial pages here.

So, in your specific case, you could convert the text to greyscale and get its average grey value. If the grey value is light (i.e. greater than 128 on a scale of 0..255) make the dim box dark, and if the average greyscale value is under 128 make the dim box light.

That buys you this:

enter image description here

Or this:

enter image description here

Another possibility is to draw the text twice, once in a bright and once in a dark colour, adding an x,y offset and a blur the first time so it looks like a soft shadow behind the hard outline of the second, unblurred version.

Post a Comment for "Check Visibility (contrast?) Between Text Image With Transparency On Top Of Background Image"