in reply to Re: Adding a watermark to an image with GD::Image
in thread Adding a watermark to an image with GD::Image

Another thought: Actually looking at your second sample image another option rather than changing the watermark color might be if it's too dark then just write it first 2 pixels larger in a lighter color and then write the dark version on top (so it'd be outlined).

WoW! That's some selection of possible solutions from you Fletch. Thank you, it is certainly giving me some ideas to try out.

The idea of an outline by printing the text twice in different colours certainly has plenty of merit. Potentially it would eliminate the need to sample the background at all. If there's a dark outer part to the text and a lighter inner then one or other should contrast with the background sufficiently.

I may have to find two suitable TTF sources or find one and make a copy with slightly narrower font strokes so one sits inside the other. That shouldn't be a big problem.

  • Comment on Re^2: Adding a watermark to an image with GD::Image

Replies are listed 'Best First'.
Re^3: Adding a watermark to an image with GD::Image
by clueless newbie (Curate) on Jan 07, 2021 at 12:09 UTC

      It's a nice idea, but won't that suffer the same problem? ie. Bod will still need to contrast that outline with the image background otherwise it might still be black-on-black or whatever.


      🦛

        It shouldn't, as at least one of the outline or the fill colour should be visible.

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
        but won't that suffer the same problem?

        I think it will hippo but I am currently looking for a suitable TTF file to test it out...

        Update...
        As expected, an outline font doesn't help as the middle bit is transparent.

        This still looks OK but
        This doesn't...

        The text overflows the images because the font is much wider than the one I originally used.