image: Removed catimg support. Fixed sixel size.

This commit is contained in:
Dylan Araps 2018-05-28 09:27:41 +10:00
parent e2274fddd8
commit 92ecdf0012

View file

@ -638,7 +638,7 @@ disk_display="off"
# Image backend. # Image backend.
# #
# Default: 'ascii' # Default: 'ascii'
# Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'termpix', 'pixterm', 'tycat', 'w3m' # Values: 'ascii', 'caca', 'jp2a', 'iterm2', 'off', 'termpix', 'pixterm', 'tycat', 'w3m'
# Flag: --backend # Flag: --backend
image_backend="ascii" image_backend="ascii"
@ -740,14 +740,6 @@ crop_offset="center"
# --size # --size
image_size="auto" image_size="auto"
# Catimg block size.
# Control the resolution of catimg.
#
# Default: '2'
# Values: '1', '2'
# Flags: --catimg_size
catimg_size="2"
# Gap between image and text # Gap between image and text
# #
# Default: '3' # Default: '3'
@ -3388,7 +3380,7 @@ image_backend() {
"ascii") get_ascii ;; "ascii") get_ascii ;;
"off") image_backend="off" ;; "off") image_backend="off" ;;
"caca" | "catimg" | "jp2a" | "iterm2" | "termpix" |\ "caca" | "jp2a" | "iterm2" | "termpix" |\
"tycat" | "w3m" | "sixel" | "pixterm" | "kitty") "tycat" | "w3m" | "sixel" | "pixterm" | "kitty")
get_image_source get_image_source
@ -3417,7 +3409,7 @@ image_backend() {
*) *)
err "Image: Unknown image backend specified '$image_backend'." err "Image: Unknown image backend specified '$image_backend'."
err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'kitty', err "Image: Valid backends are: 'ascii', 'caca', 'jp2a', 'iterm2', 'kitty',
'off', 'sixel', 'pixterm', 'termpix', 'tycat', 'w3m')" 'off', 'sixel', 'pixterm', 'termpix', 'tycat', 'w3m')"
err "Image: Falling back to ascii mode." err "Image: Falling back to ascii mode."
get_ascii get_ascii
@ -3799,11 +3791,6 @@ display_image() {
to_off "Image: libcaca failed to display the image." to_off "Image: libcaca failed to display the image."
;; ;;
"catimg")
catimg -w "$((width*2 / font_width))" -r "$catimg_size" "$image" ||\
to_off "Image: catimg failed to display the image."
;;
"jp2a") "jp2a")
jp2a --width="$((width / font_width))" \ jp2a --width="$((width / font_width))" \
--height="$((height / font_height))" \ --height="$((height / font_height))" \
@ -3824,7 +3811,9 @@ display_image() {
;; ;;
"sixel") "sixel")
img2sixel -w "$width" "$image" ||\ img2sixel -w "$width" \
-h "$height" \
"$image" ||\
to_off "Image: libsixel failed to display the image." to_off "Image: libsixel failed to display the image."
;; ;;
@ -4205,7 +4194,6 @@ kde_config_dir() {
dynamic_prompt() { dynamic_prompt() {
[[ "$image_backend" == "off" ]] && { printf "\n"; return; } [[ "$image_backend" == "off" ]] && { printf "\n"; return; }
[[ "$image_backend" != "ascii" ]] && lines="$(((height + yoffset) / font_height))" [[ "$image_backend" != "ascii" ]] && lines="$(((height + yoffset) / font_height))"
[[ "$image_backend" == "catimg" ]] && { printf "%b" "\e[1000B"; return; }
# If the ascii art is taller than the info. # If the ascii art is taller than the info.
if ((lines > info_height)); then if ((lines > info_height)); then
@ -4459,14 +4447,13 @@ BARS:
IMAGE BACKEND: IMAGE BACKEND:
--backend backend Which image backend to use. --backend backend Which image backend to use.
Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', Possible values: 'ascii', 'caca', 'jp2a', 'iterm2', 'off',
'sixel', 'tycat', 'w3m' 'sixel', 'tycat', 'w3m'
--source source Which image or ascii file to use. --source source Which image or ascii file to use.
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img',
'/path/to/ascii', '/path/to/dir/' '/path/to/ascii', '/path/to/dir/'
--ascii source Shortcut to use 'ascii' backend. --ascii source Shortcut to use 'ascii' backend.
--caca source Shortcut to use 'caca' backend. --caca source Shortcut to use 'caca' backend.
--catimg source Shortcut to use 'catimg' backend.
--iterm2 source Shortcut to use 'iterm2' backend. --iterm2 source Shortcut to use 'iterm2' backend.
--jp2a source Shortcut to use 'jp2a' backend. --jp2a source Shortcut to use 'jp2a' backend.
--kitty source Shortcut to use 'kitty' backend. --kitty source Shortcut to use 'kitty' backend.
@ -4508,7 +4495,6 @@ IMAGE:
in some terminals emulators when using image mode. in some terminals emulators when using image mode.
--size 00px | --size 00% How to size the image. --size 00px | --size 00% How to size the image.
Possible values: auto, 00px, 00%, none Possible values: auto, 00px, 00%, none
--catimg_size 1/2 Change the resolution of catimg.
--crop_mode mode Which crop mode to use --crop_mode mode Which crop mode to use
Takes the values: normal, fit, fill Takes the values: normal, fit, fill
--crop_offset value Change the crop offset for normal mode. --crop_offset value Change the crop offset for normal mode.
@ -4652,7 +4638,7 @@ get_args() {
# Image backend # Image backend
"--backend") image_backend="$2" ;; "--backend") image_backend="$2" ;;
"--source") image_source="$2" ;; "--source") image_source="$2" ;;
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\ "--ascii" | "--caca" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
"--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty") "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty")
image_backend="${1/--}" image_backend="${1/--}"
case "$2" in case "$2" in
@ -4664,7 +4650,6 @@ get_args() {
# Image options # Image options
"--loop") image_loop="on" ;; "--loop") image_loop="on" ;;
"--image_size" | "--size") image_size="$2" ;; "--image_size" | "--size") image_size="$2" ;;
"--catimg_size") catimg_size="$2" ;;
"--crop_mode") crop_mode="$2" ;; "--crop_mode") crop_mode="$2" ;;
"--crop_offset") crop_offset="$2" ;; "--crop_offset") crop_offset="$2" ;;
"--xoffset") xoffset="$2" ;; "--xoffset") xoffset="$2" ;;