Skip to content

Commit

Permalink
desktop.media.image-compact: normalize filename ext to .jpg if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-fg committed Oct 29, 2024
1 parent 9c622c7 commit e8d6e30
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion desktop/media/image-compact
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ for p in "$@"; do
magick "$p" -resize "${sz}>" -quality 80 "$p".fix.jpg
jpegoptim -q --strip-all --all-normal --force "$p".fix.jpg
mv "$p".fix.jpg "$p"

ext="${p##*.}"
[[ "$ext" = jpg ]] && ext= || {
if [[ ${#ext} -gt 4 ]]
then echo >&2 "WARN: no proper filename.ext on [ $p ]"; ext=" :: $ext ???"
else mv "$p" "${p%.*}.jpg"; ext=" :: $ext -> jpg"; fi; }

du2=$(du_hs "$p")
echo "$p :: $du1 -> $du2"
echo "$p :: $du1 -> $du2$ext"
done

0 comments on commit e8d6e30

Please sign in to comment.