feat: improved image quality
This commit is contained in:
parent
adaff4e285
commit
a9e6bbd878
@ -20,19 +20,25 @@ if [ "${1:-}" = "--preview" ]; then
|
|||||||
"$AWK_PREVIEW" "$file" |
|
"$AWK_PREVIEW" "$file" |
|
||||||
$CAT
|
$CAT
|
||||||
# Get photo, if supported and if it exists
|
# Get photo, if supported and if it exists
|
||||||
if [ "${CHAFA:-}" ]; then
|
if [ "${KITTY:-}" ]; then
|
||||||
photo=$(mktemp)
|
photo=$(mktemp)
|
||||||
awk -v field="PHOTO" "$AWK_GET" "$file" | base64 -d -i >"$photo"
|
awk -v field="PHOTO" "$AWK_GET" "$file" | base64 -d -i >"$photo"
|
||||||
type=$(file --mime-type -b "$photo" | cut -d '/' -f 1)
|
type=$(file --mime-type -b "$photo" | cut -d '/' -f 1)
|
||||||
if [ "$type" = "image" ]; then
|
if [ "$type" != "image" ]; then
|
||||||
WIDTH=80
|
cat <<EOF >"$photo"
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="1pt" height="1pt" viewBox="0.00 0.00 1.00 1.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
WIDTH=30
|
||||||
if [ "$FZF_PREVIEW_COLUMNS" -lt "$WIDTH" ]; then
|
if [ "$FZF_PREVIEW_COLUMNS" -lt "$WIDTH" ]; then
|
||||||
WIDTH="$FZF_PREVIEW_COLUMNS"
|
WIDTH="$FZF_PREVIEW_COLUMNS"
|
||||||
fi
|
fi
|
||||||
$CHAFA -f symbols -s "$WIDTH" "$photo"
|
$KITTY icat --clear --transfer-mode=memory --stdin=no --place="$WIDTH"x"$FZF_PREVIEW_LINES"@0x0 "$photo"
|
||||||
|
# $CHAFA -f symbols -s "$WIDTH" "$photo"
|
||||||
fi
|
fi
|
||||||
rm "$photo"
|
rm "$photo"
|
||||||
fi
|
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ if command -v "git" >/dev/null && [ -d "$ROOT/.git" ]; then
|
|||||||
export GIT
|
export GIT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v "chafa" >/dev/null; then
|
if command -v "kitty" >/dev/null; then
|
||||||
CHAFA="chafa"
|
KITTY="kitty"
|
||||||
export CHAFA
|
export KITTY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export OPEN=${OPEN:-open}
|
export OPEN=${OPEN:-open}
|
||||||
|
Loading…
Reference in New Issue
Block a user