A script to generate Chafa galleries for gmi
Hey! I can only take credit for the idea, but I am sharing a little script cobbled together with artificial help that generates a little .gmi ANSI gallery out of images in a directory.
An example:
$ ls
something.jpeg
something_else.jpeg
testing.jpeg
another.jpeg
somefile.jpeg
$ ./chafa-gmi-gallery-gen.sh
Enter gallery name or leave blank to use the current date ('2024-04-20'): test
Enter image file extension(s) to look for or leave blank for all images (e.g., 'JPG' or 'png, jpg, gif, jpeg'): jpeg
Processing...
$ cd test
$ ls
index.gmi test-1.gmi test-2.gmi test-3.gmi test-4.gmi test-5.gmi
#ansi #chafa #gallery #script
2024-04-20 · 2 years ago · 👍 mozz, norayr, gemalaya, Nono
4 Comments ↓
Some more notes:
- If no gallery name is provided, it defaults to current date for gallery title and retains original file names.
- You can supply several image file types, comma separated.
- Feel free to change the chafa settings in the script. Currently it is set to output 240 colours, dithered, foreground only (for better compatbility), at a size of a 128 characters (felt the right mix). See the chafa man page for additional settings.
And let me know what you think.
What is a chafa?
It's in the links, but Chafa is a command line tool to convert images to ANSI / ASCII art for displaying in the terminal. Pretty neat. Many Gemini clients like Offpunk rely on it.