Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/elfmz/far2l.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelfmz <fenix1905@tut.by>2022-11-06 14:36:09 +0300
committerelfmz <fenix1905@tut.by>2022-11-06 14:36:09 +0300
commitdd90814dd17bdc802bf1711cab22bac385498eed (patch)
treed85def02392cac7e56b3620ed9c4b18c3931ebb9
parent6acba431919214b322b03ed5dc4cf16968f59815 (diff)
processed view: add timg and remove 16 color limitation from chafa command line (close #901)
-rwxr-xr-xfar2l/bootstrap/view.sh19
1 files changed, 13 insertions, 6 deletions
diff --git a/far2l/bootstrap/view.sh b/far2l/bootstrap/view.sh
index 65ada726..7bba89e9 100755
--- a/far2l/bootstrap/view.sh
+++ b/far2l/bootstrap/view.sh
@@ -298,21 +298,28 @@ if [[ "$FILE" == *": "*"image data, "* ]] \
TLINES=$( bash -c "echo ${LINES}" )
TCOLUMNS=$(( ${TCOLUMNS:-80} - 0 ))
TLINES=$(( ${TLINES:-25} - 2 ))
- VCHAFA="no"
+ VPRETTY="no"
if command -v chafa >/dev/null 2>&1; then
- VCHAFA="yes"
+ VPRETTY="yes"
# chafa -c 16 --color-space=din99d --dither=ordered -w 9 --symbols all --fill all !.! && read -n1 -r -p "$1" >>"$2" 2>&1
TCOLUMNS=$(( ${TCOLUMNS:-80} - 1 ))
chafa -c none --symbols -all+stipple+braille+ascii+space+extra --size ${TCOLUMNS}x${TLINES} "$1" >>"$2" 2>&1
echo "Image is viewed by chafa in "${TCOLUMNS}"x"${TLINES}" symbols sized area" >>"$2" 2>&1
- chafa -c 16 --color-space=din99d -w 9 --symbols all --fill all "$1" && read -n1 -r -p "" >>"$2" 2>&1
+ chafa --color-space=din99d -w 9 --symbols all --fill all "$1" && read -n1 -r -p "" >>"$2" 2>&1
clear
+
+ elif command -v timg >/dev/null 2>&1; then
+ VPRETTY="yes"
+ timg "$1" && read -n1 -r -p "" >>"$2" 2>&1
+ clear
+
else
- echo "Install <chafa> to see picture" >>"$2" 2>&1
+ echo "Install <chafa> or <timg> to see pretty picture" >>"$2" 2>&1
fi
+
VJP2A="no"
if [[ "$FILE" == *": "*"JPEG image"* ]] \
- && [[ "$VCHAFA" == "no" ]]; then
+ && [[ "$VPRETTY" == "no" ]]; then
if command -v jp2a >/dev/null 2>&1; then
VJP2A="yes"
# jp2a --colors "$1" >>"$2" 2>&1
@@ -328,7 +335,7 @@ if [[ "$FILE" == *": "*"image data, "* ]] \
fi
fi
VASCIIART="no"
- if [[ "$VCHAFA" == "no" ]] \
+ if [[ "$VPRETTY" == "no" ]] \
&& [[ "$VJP2A" == "no" ]]; then
if command -v asciiart >/dev/null 2>&1; then
VASCIIART="yes"