I’m using blurred images in my site, mostly for filling background in different aspect ratio, but others use it for previews as well. I’m currently doing manual blurs by defining a very small derivation (5x5 in most cases), like
derivation :blur do |file, width, height| ImageProcessing::Vips .source(file) .resize_to_limit(width.to_i, height.to_i) .saver(optimize_coding: true, strip: true, q: 1) .convert!('jpg') end
The obvious disadvantages are creating many small files and, even worse, delivering many small files to browsers.
I recently stumbled over https://blurha.sh/ (github: https://github.com/woltapp/blurhash) and considered moving to that. Is there something already available, e.g. as a plugin, or do I need to roll my own? I considered adding the blur-hash string as metadata field and outputting that directly to HTML. Do you have a better idea how to integrate it better?