Adding automatic watermarks to MapKnitter Images
Hello team! I'm working on a project that involves downloading a number of images from MapKnitter. I want to be sure that the original poster gets credit, so I've been adding watermarks to each of the image. While this is doable via image sequencer, I'm wondering if there's a way we can add automated watermarks with the original posters handle and maybe the MapKnitter url. Ideally, this watermark would be added when you download the image. I think it could be a great way to push for attribution of content to the creators. What would a workflow for this look like?
Hi Mimi! Thanks! I have a semi-working version for development testing here:
javascript:(function()%7Bfunction callback()%7Bvar sequencer %3D ImageSequencer()%3Bvar name=prompt('name');sequencer.replaceImage("img"%2C"text-overlay{text:%40"+name+"%7Cfont:arial%7Ccolor:white}")%7Dvar s%3Ddocument.createElement("script")%3Bs.src%3D"https%3A%2F%2Fpubliclab.github.io%2Fimage-sequencer%2Fdist%2Fimage-sequencer.js"%3Bif(s.addEventListener)%7Bs.addEventListener("load"%2Ccallback%2Cfalse)%7Delse if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
This can be run in a bookmarklet for testing, but the core Image Sequencer code is:
var sequencer = ImageSequencer();
var name=prompt('name');
sequencer.replaceImage("img","text-overlay{text:"+name+"|font:arial|color:white}");
This just prompts for a name and then overlays it into /all/ images in the upper left corner.
However, we're tracking a bug in https://github.com/publiclab/image-sequencer/issues/1098 that is causing this to fail. Once we fix it, we can narrow the selector from just img to just the images we want, and then substitute the uploader's name for the prompt, then this should work. Ideally we could make it not white but maybe 50% opacity white?
and just noting that we /do/ have ImageSequencer installed in this plots2 codebase, so it should be possible to instantiate as above!
Once https://github.com/publiclab/image-sequencer/issues/1098 is resolved, we can circle back here; the watermarking may not always work on all backgrounds, but if we use grey color it'll work on many of them. Someday we can make it context sensitive and use white on dark images and dark on white, or use outlining, but for now, we can aim to:
- assume uploader should be credited
- add
CC-BY-SA @username
In the case where it's been marked as not actually by that person, or not CC-BY-SA, what should we do? Should we have a popover or something that warns to check attribution?
Noting that this will not work for the full-res image you can click through to, as we won't have access to that, although we could get clever later on and come up with a solution if folks like this a lot. For the time being maybe this is a way to un-watermark if that's desired.
And, so you can see how it'll work:
https://sequencer.publiclab.org/examples/#steps=text-overlay{text:@warren|font:arial|color:white}
That outputs this:
