chafa
chafa copied to clipboard
"Unknown file format" when using stdin for AVIF on Linux
Running the following works:
chafa lisa.avif
cat lisa.avif | chafa /dev/stdin # this is a bashism
The following does not work:
cat lisa.avif | chafa
cat lisa.avif | chafa -
This is not because of the file extension itself as removing it makes no difference.
lisa.avif.tar.gz
Hi, thanks for reporting this.
AVIF is handled by the generic ImageMagick-based loader, and it needs a workaround to handle situations where chafa already processed stdin looking for headers etc. Since ImageMagick support is going away soon, I'm a little torn on whether this is worth doing. It'd be better to add a native AVIF loader instead.
I'm interested in avif as it is excellent for small files. I've been using heifg-enc and avifenc. Cannot decide which is better. Both generate files that chafa loads with wrong colors btw .
I'll see if I can prioritize an AVIF loader. I'd love to have a test case or two that come up with wrong colors currently.
(A native AVIF loader will also solve the stdin problem).
I have it this chafa limitation when browsing on https://arne.me/articles/emacs-from-scratch-part-one-foundations/ with offpunk.
Ok. Will have to do this for the next milestone.
No urgency. It is the first time I encounter this format in the wild.
Also, I’ve implemented a quick workaround: if chafa fails to open a picture, offpunk fallsback to timg.
Just realized I already added native AVIF support (see #157), but overlooked this issue. It works for me on master, fix will be in 1.14.0!