tdemin / gmnhg

Hugo-to-Gemini Markdown converter
GNU General Public License v3.0
29 stars 1 forks source link

Automatic processing (dithering) of images/preview images #37

Closed mntn-xyz closed 3 years ago

mntn-xyz commented 3 years ago

Perhaps this is better for a plugin, or another program entirely, but I got this idea after seeing the Gemini "imageboard" someone just made (iich.space/img) and I couldn't help but share it.

What if there were an option to either generate dithered "preview" images (or to replace the images entirely) via this library: https://github.com/makeworld-the-better-one/dither

I'm more partial to generating preview images, because some things like technical diagrams wouldn't work so well with dithering. But I can imagine that people running their Gemini sites on low bandwidth/low power servers might want the option to shrink all their images.

tdemin commented 3 years ago

I wonder if this is still the scope of this project, and not a Makefile directive (or whichever tool you prefer, might be Nix, Taskfile, etc) for build automation. Passing fd '.[png|jpeg|jpg|tif]' | xargs -n1 dither requires much less effort and fits, say, Unix ideology (do one thing and do it well).

Sadly, this would require dither to implement a command-line wrapper to the library.

PS: there's also of course a point to be made that Hugo implements a resource system, but I wonder how much of a maintenance burden it's going to add in, provided Hugo does quite a lot with it: language preprocessing, fingerprinting, image conversion, etc...

mntn-xyz commented 3 years ago

Yes, you're probably right, especially since it would require a wrapper -- I hadn't investigated it fully. Even if I just wanted to make "preview" images (and insert links to them) then this should be easy to script, especially since (thankfully) Gemtext is a very simple format.

tdemin commented 3 years ago

For those interested: there's actually a command-line wrapper for dither called didder, which can be installed from here.

mntn-xyz commented 3 years ago

I made a script for this if anyone needs it in the future: https://git.sr.ht/~mntn/gemdither

(I should have done it in go. "Just a quick script"... sure.)