[READ-ONLY] Mirror of https://github.com/mrgnw/scripts.
0

Configure Feed

Select the types of activity you want to include in your feed.

avifs: use img2avif for RAW files, avifenc for standard images

RAW files (ARW, CR2, NEF, etc.) are now decoded and encoded
in-memory via img2avif (pure Rust) — no intermediary files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+23 -2
+23 -2
avifs
··· 1 1 #!/usr/bin/env zsh 2 + # brew install libavif 2 3 set -euo pipefail 3 4 setopt nocaseglob 4 5 ··· 31 32 orig_size=$(( orig_size + $(stat -f%z "$f") )) 32 33 done 33 34 34 - printf '%s\0' "${files[@]}" | parallel -0 'avifenc -j 1 --speed 6 {} {.}.avif' 35 + raw_exts=(${(f)"$(globs raw)"}) 36 + raw_exts=(${raw_exts/\*./}) 37 + 38 + raw_files=() 39 + normal_files=() 40 + for f in "${files[@]}"; do 41 + ext="${f##*.}" 42 + if (( ${raw_exts[(Ie)${ext:l}]} )); then 43 + raw_files+=("$f") 44 + else 45 + normal_files+=("$f") 46 + fi 47 + done 48 + 49 + if [[ ${#raw_files[@]} -gt 0 ]]; then 50 + img2avif --quality 60 --speed 6 "${raw_files[@]}" 51 + fi 52 + 53 + if [[ ${#normal_files[@]} -gt 0 ]]; then 54 + printf '%s\0' "${normal_files[@]}" | parallel -0 'avifenc -j 1 --speed 6 {} {.}.avif' 55 + fi 35 56 36 57 avif_size=0 37 58 converted=0 ··· 39 60 avif="${f%.*}.avif" 40 61 if [[ -f "$avif" ]]; then 41 62 avif_size=$(( avif_size + $(stat -f%z "$avif") )) 42 - (( converted++ )) 63 + converted=$(( converted + 1 )) 43 64 fi 44 65 done 45 66 saved=$(( orig_size - avif_size ))