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.
#
# 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
image_backend="ascii"
@ -740,14 +740,6 @@ crop_offset="center"
# --size
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
#
# Default: '3'
@ -3388,7 +3380,7 @@ image_backend() {
"ascii") get_ascii ;;
"off") image_backend="off" ;;
"caca" | "catimg" | "jp2a" | "iterm2" | "termpix" |\
"caca" | "jp2a" | "iterm2" | "termpix" |\
"tycat" | "w3m" | "sixel" | "pixterm" | "kitty")
get_image_source
@ -3417,7 +3409,7 @@ 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')"
err "Image: Falling back to ascii mode."
get_ascii
@ -3799,11 +3791,6 @@ display_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 --width="$((width / font_width))" \
--height="$((height / font_height))" \
@ -3824,7 +3811,9 @@ display_image() {
;;
"sixel")
img2sixel -w "$width" "$image" ||\
img2sixel -w "$width" \
-h "$height" \
"$image" ||\
to_off "Image: libsixel failed to display the image."
;;
@ -4205,7 +4194,6 @@ kde_config_dir() {
dynamic_prompt() {
[[ "$image_backend" == "off" ]] && { printf "\n"; return; }
[[ "$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 ((lines > info_height)); then
@ -4459,14 +4447,13 @@ BARS:
IMAGE BACKEND:
--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'
--source source Which image or ascii file to use.
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img',
'/path/to/ascii', '/path/to/dir/'
--ascii source Shortcut to use 'ascii' backend.
--caca source Shortcut to use 'caca' backend.
--catimg source Shortcut to use 'catimg' backend.
--iterm2 source Shortcut to use 'iterm2' backend.
--jp2a source Shortcut to use 'jp2a' backend.
--kitty source Shortcut to use 'kitty' backend.
@ -4508,7 +4495,6 @@ IMAGE:
in some terminals emulators when using image mode.
--size 00px | --size 00% How to size the image.
Possible values: auto, 00px, 00%, none
--catimg_size 1/2 Change the resolution of catimg.
--crop_mode mode Which crop mode to use
Takes the values: normal, fit, fill
--crop_offset value Change the crop offset for normal mode.
@ -4652,7 +4638,7 @@ get_args() {
# Image backend
"--backend") image_backend="$2" ;;
"--source") image_source="$2" ;;
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
"--ascii" | "--caca" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
"--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty")
image_backend="${1/--}"
case "$2" in
@ -4664,7 +4650,6 @@ get_args() {
# Image options
"--loop") image_loop="on" ;;
"--image_size" | "--size") image_size="$2" ;;
"--catimg_size") catimg_size="$2" ;;
"--crop_mode") crop_mode="$2" ;;
"--crop_offset") crop_offset="$2" ;;
"--xoffset") xoffset="$2" ;;