Commit 9061c37e authored by Eugen Rochko's avatar Eugen Rochko

Add image

parent 4f51cc7f
Pipeline #730 passed with stages
in 18 seconds
......@@ -15,6 +15,8 @@ Mastodon allows you to put content warnings on post. These can be textual, hidin
Beyond providing visual protection against say, co-workers looking over your shoulder to see something inappropriate on your screen, Mastodon also does not load said images or videos at all until you choose to unhide them, which helps if it's important that inappropriate content is not stored in your browser's cache. But there is a drawback. Every post with hidden media looks the same. They all blend together. Especially in public timelines, which provide a stream of all public posts that people use to explore Mastodon outside of their friend circle. As a result, posts with hidden media usually get less interactions.
{{< figure src="blurhash-demo-cat.png" caption="Side-by-side comparison of the original picture and the generated blurhash" >}}
Here comes Blurhash. Developed by [Dag Ågren][WAHa_06x36], who is behind the popular iOS app for Mastodon, [Toot!][toot], it is an algorithm that compresses a picture into a short string of letters. The string is so small that there is no problem with saving it in the database, instead of as an image file, and conversely, sending it along with API responses. That means that string is available before any image files are loaded by the browser. You can see where this is going... When you decode the string back into an image, you get a gradient of colors used in the original image.
So little information is transmitted through blurhash that is is safe to display even if the underlying content is inappropriate, and the resulting gradient is pleasant to look at. Even more importantly, it's different for each image, making posts with hidden media look different from each other, which should hopefully increases their chances of getting noticed. But that's not all! Even for posts where images and videos are not supposed to be hidden, it provides a pleasant placeholder while the much heavier image files are loaded by the browser.
......@@ -24,4 +26,4 @@ If you would like to use Blurhash in your project, there is a [Ruby port][ruby]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment