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:
parent
8cc7401fe2
commit
8b3ae7ac0b
2 changed files with 9 additions and 5 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
#!/usr/bin/env nuxr-nuxsh
|
#!/usr/bin/env nuxr-nuxsh
|
||||||
|
|
||||||
|
|
||||||
type ffmpeg > /dev/null 2>&1 && FFMPEG_OR_LIBAV=ffmpeg
|
type ffmpeg > /dev/null 2>&1 && FFMPEG_OR_LIBAV=ffmpeg
|
||||||
type avconv > /dev/null 2>&1 && FFMPEG_OR_LIBAV=avconv
|
type avconv > /dev/null 2>&1 && FFMPEG_OR_LIBAV=avconv
|
||||||
|
type gm /dev/null 2>&1 && NUX_MAGICK=gm
|
||||||
|
|
||||||
QUALITY=${QUALITY:=90}
|
QUALITY=${QUALITY:=90}
|
||||||
|
|
||||||
|
|
@ -36,10 +38,10 @@ QUALITY=${QUALITY:=90}
|
||||||
target_file="${target_dir}/$name";
|
target_file="${target_dir}/$name";
|
||||||
fi
|
fi
|
||||||
echo "Image: $i/$count Downsampling $image -> $target_file"
|
echo "Image: $i/$count Downsampling $image -> $target_file"
|
||||||
convert $image \
|
$NUX_MAGICK convert $image \
|
||||||
-filter Lanczos -sampling-factor 1x1 \
|
-filter Lanczos -sampling-factor 1x1 \
|
||||||
-resize "${SIZE}x${SIZE}>" \
|
-resize "${SIZE}x${SIZE}>" \
|
||||||
-quality 90 \
|
-quality $QUALITY \
|
||||||
$target_file
|
$target_file
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
@ -66,5 +68,5 @@ QUALITY=${QUALITY:=90}
|
||||||
}
|
}
|
||||||
|
|
||||||
function media.to.jpg {
|
function media.to.jpg {
|
||||||
convert "$1" -quality $QUALITY -auto-orient "$2"
|
$NUX_MAGICK convert "$1" -quality $QUALITY -auto-orient "$2"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
nux.use nux.mime
|
nux.use nux.mime
|
||||||
|
|
||||||
|
type gm /dev/null 2>&1 && NUX_MAGICK=gm
|
||||||
|
|
||||||
function thumby.name.shared() {
|
function thumby.name.shared() {
|
||||||
echo $(basename "$1"|md5sum|cut -d " " -f1).png
|
echo $(basename "$1"|md5sum|cut -d " " -f1).png
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +83,7 @@ function thumby.thumb.get() {
|
||||||
|
|
||||||
$preexec "$path"
|
$preexec "$path"
|
||||||
nux.log info "Source is : $source, Streamer is $streamer";
|
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"
|
$postexec "$path"
|
||||||
echo $thumbpath;
|
echo $thumbpath;
|
||||||
fi
|
fi
|
||||||
|
|
@ -89,7 +91,7 @@ function thumby.thumb.get() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function thumby.thumb.generate() {
|
function thumby.thumb.generate() {
|
||||||
convert -thumbnail '256x256>' -strip "$path" "$thumbpath" >&2
|
$NUX_MAGICK convert -thumbnail '256x256>' -strip "$path" "$thumbpath" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
function thumby.get.thumb() {
|
function thumby.get.thumb() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue