aboutsummaryrefslogtreecommitdiff
path: root/.oh-my-zsh/plugins/catimg
diff options
context:
space:
mode:
authorMarvin Borner2020-03-16 23:33:42 +0100
committerMarvin Borner2020-03-16 23:33:42 +0100
commit0e9ddbb0bf0cd34500155ea4b03de2e2a38d8ab2 (patch)
tree719da1c7fe5dabb872fe9ff1582c39b55ccd488e /.oh-my-zsh/plugins/catimg
parente5d38956336ab1be954bdbd12808c5f98f8bd925 (diff)
Well I'm using Arch again
Diffstat (limited to '.oh-my-zsh/plugins/catimg')
-rw-r--r--.oh-my-zsh/plugins/catimg/README.md35
-rw-r--r--.oh-my-zsh/plugins/catimg/catimg.plugin.zsh17
-rw-r--r--.oh-my-zsh/plugins/catimg/catimg.sh88
-rw-r--r--.oh-my-zsh/plugins/catimg/colors.pngbin353 -> 0 bytes
4 files changed, 0 insertions, 140 deletions
diff --git a/.oh-my-zsh/plugins/catimg/README.md b/.oh-my-zsh/plugins/catimg/README.md
deleted file mode 100644
index 2fc28a1..0000000
--- a/.oh-my-zsh/plugins/catimg/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# catimg
-
-Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
-
-## Requirements
-
-- `convert` (ImageMagick)
-
-## Enabling the plugin
-
-1. Open your `.zshrc` file and add `catimg` in the plugins section:
-
- ```zsh
- plugins=(
- # all your enabled plugins
- catimg
- )
- ```
-
-2. Reload the source file or restart your Terminal session:
-
- ```console
- $ source ~/.zshrc
- $
- ```
-
-## Functions
-
-| Function | Description |
-| -------- | ---------------------------------------- |
-| `catimg` | Displays the given image on the terminal |
-
-## Usage examples
-
-[![asciicast](https://asciinema.org/a/204702.png)](https://asciinema.org/a/204702)
diff --git a/.oh-my-zsh/plugins/catimg/catimg.plugin.zsh b/.oh-my-zsh/plugins/catimg/catimg.plugin.zsh
deleted file mode 100644
index 5f58ecd..0000000
--- a/.oh-my-zsh/plugins/catimg/catimg.plugin.zsh
+++ /dev/null
@@ -1,17 +0,0 @@
-################################################################################
-# catimg script by Eduardo San Martin Morote aka Posva #
-# https://posva.net #
-# #
-# Ouput the content of an image to the stdout using the 256 colors of the #
-# terminal. #
-# Github: https://github.com/posva/catimg #
-################################################################################
-
-
-function catimg() {
- if [[ -x `which convert` ]]; then
- zsh $ZSH/plugins/catimg/catimg.sh $@
- else
- echo "catimg need convert (ImageMagick) to work)"
- fi
-}
diff --git a/.oh-my-zsh/plugins/catimg/catimg.sh b/.oh-my-zsh/plugins/catimg/catimg.sh
deleted file mode 100644
index 83ccf6a..0000000
--- a/.oh-my-zsh/plugins/catimg/catimg.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-################################################################################
-# catimg script by Eduardo San Martin Morote aka Posva #
-# https://posva.net #
-# #
-# Ouput the content of an image to the stdout using the 256 colors of the #
-# terminal. #
-# Github: https://github.com/posva/catimg #
-################################################################################
-
-function help() {
- echo "Usage catimg [-h] [-w width] [-c char] img"
- echo "By default char is \" \" and w is the terminal width"
-}
-
-# VARIABLES
-COLOR_FILE=$(dirname $0)/colors.png
-CHAR=" "
-
-WIDTH=""
-IMG=""
-
-while getopts qw:c:h opt; do
- case "$opt" in
- w) WIDTH="$OPTARG" ;;
- c) CHAR="$OPTARG" ;;
- h) help; exit ;;
- *) help ; exit 1;;
- esac
- done
-
-while [ "$1" ]; do
- IMG="$1"
- shift
-done
-
-if [ "$IMG" = "" -o ! -f "$IMG" ]; then
- help
- exit 1
-fi
-
-if [ ! "$WIDTH" ]; then
- COLS=$(expr $(tput cols) "/" $(echo -n "$CHAR" | wc -c))
-else
- COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c))
-fi
-WIDTH=$(convert "$IMG" -print "%w\n" /dev/null)
-if [ "$WIDTH" -gt "$COLS" ]; then
- WIDTH=$COLS
-fi
-
-REMAP=""
-if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
- REMAP="-remap $COLOR_FILE"
-else
- echo "The version of convert is too old, don't expect good results :(" >&2
- #convert "$IMG" -colors 256 PNG8:tmp.png
- #IMG="tmp.png"
-fi
-
-# Display the image
-I=0
-convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
-sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' |
-while read R G B f; do
- if [ ! "$R" = "NO" ]; then
- if [ "$R" -eq "$G" -a "$G" -eq "$B" ]; then
- ((
- I++,
- IDX = 232 + R * 23 / 255
- ))
- else
- ((
- I++,
- IDX = 16
- + R * 5 / 255 * 36
- + G * 5 / 255 * 6
- + B * 5 / 255
- ))
- fi
- #echo "$R,$G,$B: $IDX"
- echo -ne "\e[48;5;${IDX}m${CHAR}"
- else
- (( I++ ))
- echo -ne "\e[0m${CHAR}"
- fi
- # New lines
- (( $I % $WIDTH )) || echo -e "\e[0m"
-done
diff --git a/.oh-my-zsh/plugins/catimg/colors.png b/.oh-my-zsh/plugins/catimg/colors.png
deleted file mode 100644
index 5f2c812..0000000
--- a/.oh-my-zsh/plugins/catimg/colors.png
+++ /dev/null
Binary files differ