Closed thorlucas closed 3 years ago
According to iterm2, preserveAspectRatio
should be set to 1
to avoid this.
Ok I did some investigation. imgcat
's source:
function print_image() {
print_osc
printf '1337;File='
if [[ -n $1 ]]; then
printf "name=%s;" "$(printf "%s" "$1" | b64_encode)"
fi
printf "%s" "$3" | b64_decode | wc -c | awk '{printf "size=%d",$1}'
printf ";inline=%s" "$2"
printf ":"
printf "%s" "$3"
print_st
printf '\n'
if [[ -n $4 ]]; then
echo "$1"
fi
}
Which evaluates to
\033]1337;File=size=165;inline=1:<the base64 encoded image>\a
It seems that viuer
passing in the width and height is messing this up. I will cross post this issue to viuer
since I didn't realize at first that this was an issue on that crate instead.
Followed up in the linked viuer
issue.
I've
curl https://via.placeholder.com/20 -o 20.png
to product a 20x20 png. Then I runviu 20.png
in iTerm2.Here are the results:
As you can see the aspect ratio is clearly off. I suppose this has something to do line height setting? Does iTerm2 have API for polling this?