Aspect ratio not computed when giving only one of `r` or `c` to display image
dmlloyd opened this issue · 0 comments
Describe the bug
According to the docs:
You can also ask the terminal emulator to display the image in a specified rectangle (num of columns / num of lines), using the control codes
c
,r
.c
is the number of columns andr
the number of rows. The image will be scaled (enlarged/shrunk) as needed to fit the specified area. Note that if you specify a start cell offset via theX
,Y
keys, it is not added to the number of rows/columns. If only one of eitherr
orc
is specified, the other one is computed based on the source image aspect ratio, so that the image is displayed without distortion.
However, only providing one of r
or c
does not cause the image to be scaled by aspect ratio as the final sentence in the doc indicates.
To Reproduce
Steps to reproduce the behavior:
- Cat attached
mars.txt
- this is the original image emitted byicat
- Cat attached
mars-just-r.txt
- this is the same image withr=4
added - Cat attached
mars-just-c.txt
- this is the same iamge withc=8
added - See distorted image
Also attached is the original mars.png
. The image is public domain.
It's possible that the problem only occurs with a=T
; I haven't tested.
The problem can be reproduced without catting these files by capturing icat --transfer-mode=stream mars.png
and editing the resultant text to add r=4
or c=8
.
Environment details
kitty 0.34.1 (7f61f1f9f3) created by Kovid Goyal
Darwin cactaur 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 arm64
ProductName: macOS ProductVersion: 14.4.1 BuildVersion: 23E224
Frozen: True
Paths:
kitty: /Applications/kitty.app/Contents/MacOS/kitty
base dir: /Applications/kitty.app/Contents/Resources/kitty
extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
system shell: /bin/bash
Loaded config files:
/Users/david/.config/kitty/kitty.conf
Config options different from defaults:
background_opacity 0.85
confirm_os_window_close 0
enable_audio_bell False
font_family DejaVu Sans Mono
font_size 13.0
Removed shortcuts:
cmd+, → edit_config_file
cmd+enter → new_window
cmd+h → hide_macos_app
cmd+k → clear_terminal to_cursor active
cmd+m → minimize_macos_window
cmd+n → new_os_window
cmd+q → quit
cmd+t → new_tab
cmd+w → close_tab
ctrl+cmd+, → load_config_file
ctrl+cmd+f → toggle_fullscreen
opt+cmd+h → hide_macos_other_apps
opt+cmd+r → clear_terminal reset active
opt+cmd+s → toggle_macos_secure_keyboard_entry
shift+cmd+/ → open_url https://sw.kovidgoyal.net/kitty/
shift+cmd+[ → previous_tab
shift+cmd+] → next_tab
shift+cmd+d → close_window
shift+cmd+w → close_os_window
Important environment variables seen by the kitty process:
PATH /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
LANG en_US.UTF-8
SHELL /bin/bash
USER david