|
|
|
|
@ -1954,7 +1954,7 @@ image_backend() { |
|
|
|
|
"ascii") get_ascii ;; |
|
|
|
|
"off") image_backend="off" ;; |
|
|
|
|
|
|
|
|
|
"iterm2" | "w3m" | "tycat" | "catimg" | "caca") |
|
|
|
|
"caca" | "catimg" | "jp2a" | "iterm2" | "tycat" | "w3m") |
|
|
|
|
get_image_source |
|
|
|
|
|
|
|
|
|
if [[ ! -f "$image" ]]; then |
|
|
|
|
@ -1985,7 +1985,6 @@ image_backend() { |
|
|
|
|
err "Image: Falling back to ascii mode." |
|
|
|
|
get_ascii |
|
|
|
|
;; |
|
|
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
|
|
# Set cursor position next image/ascii. |
|
|
|
|
@ -2339,14 +2338,22 @@ make_thumbnail() { |
|
|
|
|
|
|
|
|
|
display_image() { |
|
|
|
|
case "$image_backend" in |
|
|
|
|
"w3m") |
|
|
|
|
get_w3m_img_path |
|
|
|
|
"caca") |
|
|
|
|
img2txt -W "$((width / font_width))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Images: catimg failed to display the image." |
|
|
|
|
text_padding="$((columns / 2 + gap))" |
|
|
|
|
zws= |
|
|
|
|
;; |
|
|
|
|
|
|
|
|
|
# Add a tiny delay to fix issues with images not |
|
|
|
|
# appearing in specific terminal emulators. |
|
|
|
|
sleep 0.05 |
|
|
|
|
printf "%b\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$image\n4;\n3;" |\ |
|
|
|
|
"${w3m_img_path:-false}" -bg "$background_color" >/dev/null & 2>&1 || to_off "Images: w3m-img failed to display the image." |
|
|
|
|
"catimg") |
|
|
|
|
catimg -w "$columns" "$image" || to_off "Images: catimg failed to display the image." |
|
|
|
|
text_padding="$((columns / 2 + gap))" |
|
|
|
|
zws= |
|
|
|
|
;; |
|
|
|
|
|
|
|
|
|
"jp2a") |
|
|
|
|
jp2a --width="$((width / font_width))" --colors "$image" || to_off "Images: jp2a failed to display the image." |
|
|
|
|
text_padding="$((columns / 2 + gap))" |
|
|
|
|
zws= |
|
|
|
|
;; |
|
|
|
|
|
|
|
|
|
"iterm2") |
|
|
|
|
@ -2357,16 +2364,14 @@ display_image() { |
|
|
|
|
tycat "$image" || to_off "Images: tycat failed to display the image." |
|
|
|
|
;; |
|
|
|
|
|
|
|
|
|
"catimg") |
|
|
|
|
catimg -w "$columns" "$image" || to_off "Images: catimg failed to display the image." |
|
|
|
|
text_padding="$((columns / 2 + gap))" |
|
|
|
|
zws= |
|
|
|
|
;; |
|
|
|
|
"w3m") |
|
|
|
|
get_w3m_img_path |
|
|
|
|
|
|
|
|
|
"caca") |
|
|
|
|
img2txt -W "$((width / font_width))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Images: catimg failed to display the image." |
|
|
|
|
text_padding="$((columns / 2 + gap))" |
|
|
|
|
zws= |
|
|
|
|
# Add a tiny delay to fix issues with images not |
|
|
|
|
# appearing in specific terminal emulators. |
|
|
|
|
sleep 0.05 |
|
|
|
|
printf "%b\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$image\n4;\n3;" |\ |
|
|
|
|
"${w3m_img_path:-false}" -bg "$background_color" >/dev/null & 2>&1 || to_off "Images: w3m-img failed to display the image." |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|
} |
|
|
|
|
@ -3706,7 +3711,7 @@ BARS: |
|
|
|
|
|
|
|
|
|
IMAGE BACKEND: |
|
|
|
|
--image_backend backend Which image backend to use. |
|
|
|
|
Possible values: 'ascii', 'caca', 'catimg', 'iterm2', 'off', 'tycat', 'w3m' |
|
|
|
|
Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m' |
|
|
|
|
--image_source source Which image or ascii file to use. |
|
|
|
|
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' |
|
|
|
|
--ascii Shortcut to use 'ascii' backend. |
|
|
|
|
@ -3916,6 +3921,7 @@ get_args() { |
|
|
|
|
"--ascii") image_backend="ascii" ;; |
|
|
|
|
"--caca") image_backend="caca" ;; |
|
|
|
|
"--catimg") image_backend="catimg" ;; |
|
|
|
|
"--jp2a") image_backend="jp2a" ;; |
|
|
|
|
"--iterm2") image_backend="iterm2" ;; |
|
|
|
|
"--off") image_backend="off" ;; |
|
|
|
|
"--tycat") image_backend="tycat" ;; |
|
|
|
|
|