1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

Use graphicsmagick if possible.

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2019-11-28 12:20:36 +01:00
parent 8cc7401fe2
commit 8b3ae7ac0b
2 changed files with 9 additions and 5 deletions

View file

@ -1,7 +1,9 @@
#!/usr/bin/env nuxr-nuxsh
type ffmpeg > /dev/null 2>&1 && FFMPEG_OR_LIBAV=ffmpeg
type avconv > /dev/null 2>&1 && FFMPEG_OR_LIBAV=avconv
type gm /dev/null 2>&1 && NUX_MAGICK=gm
QUALITY=${QUALITY:=90}
@ -36,10 +38,10 @@ QUALITY=${QUALITY:=90}
target_file="${target_dir}/$name";
fi
echo "Image: $i/$count Downsampling $image -> $target_file"
convert $image \
$NUX_MAGICK convert $image \
-filter Lanczos -sampling-factor 1x1 \
-resize "${SIZE}x${SIZE}>" \
-quality 90 \
-quality $QUALITY \
$target_file
done
}
@ -66,5 +68,5 @@ QUALITY=${QUALITY:=90}
}
function media.to.jpg {
convert "$1" -quality $QUALITY -auto-orient "$2"
$NUX_MAGICK convert "$1" -quality $QUALITY -auto-orient "$2"
}

View file

@ -1,5 +1,7 @@
nux.use nux.mime
type gm /dev/null 2>&1 && NUX_MAGICK=gm
function thumby.name.shared() {
echo $(basename "$1"|md5sum|cut -d " " -f1).png
}
@ -81,7 +83,7 @@ function thumby.thumb.get() {
$preexec "$path"
nux.log info "Source is : $source, Streamer is $streamer";
$streamer "$path" | convert -thumbnail '256x256>' -strip "$source" "$thumbpath" >&2
$streamer "$path" | $NUX_MAGICK convert -thumbnail '256x256>' -strip "$source" "$thumbpath" >&2
$postexec "$path"
echo $thumbpath;
fi
@ -89,7 +91,7 @@ function thumby.thumb.get() {
}
function thumby.thumb.generate() {
convert -thumbnail '256x256>' -strip "$path" "$thumbpath" >&2
$NUX_MAGICK convert -thumbnail '256x256>' -strip "$path" "$thumbpath" >&2
}
function thumby.get.thumb() {