Sunday, February 13, 2022

Silent Mode - Custom Images?

This post is for folks who use silent mode - I've gotten some feedback from a couple helpful users:

qvim's hope: "...change the silent mode images, it would be my preference for me to choose my own images for this mode. there's nothing wrong with the images just that i would like to have the ones i prefer"

Cranky's hope: "...Ability to add custom images for silent mode from an online database of SFW images (you can memorize the stock images pretty quickly, defeating the purpose)", "Ability to lighten/darken/remove the watermark in silent mode"

  Silent mode is one of my personal favorite features, so it makes me happy to hear that others are using it - and using it enough that they'd like to see it expanded somehow.

So first, let's talk just a bit about how silent mode works right now. I've gotten a number of images from Unsplash, downsized them heavily, and included them directly in the addon (~100 images in ~2MB!). I've also created an index of  metadata for attribution as well as some data for image similarity, so that in theory the images being replaced seem less out of place. Honestly, I don't think that it works particularly well in that regard, but there is a rudimentary method in there right now that does that.

So, what about adding your own images? To do so I think there would be a couple approaches:

  1. Drag and drop your images onto the addon settings page.
  2. Provide a way to get placeholder images from the web.

Since the image similarity code is done as a pre-build step, the logic isn't even in the JS of the addon, so both potential methods might lack a bit there.

Option #1 wouldn't be too hard but I'd have to look into local storage limits. I think we might hit some issues there, particularly if folks aren't resizing the images as heavily as I did. Additionally, if images are handpicked, Cranky's note about memorizing the stock images still is unsolved unless many, many images are put in - which will definitely have problems with local storage limits.

Option #2 provides more flexibility - for example, see this list of placeholder image services. Most of these image services tend to provide a URL where the desired width and height is supplied, which would mesh well with the addon's current functionality.

I think option #2 comes with fewer headaches, but let me know over on GitHub!

(Update: the adventurous may wish to watch this branch...)