chbg: to shrink image when too large (i.e. bigger than 3840x2160).
- images too large may cause lagging, especially gtklock.
This commit is contained in:
14
bin/chbg
14
bin/chbg
@@ -3,10 +3,20 @@
|
||||
[ -z "$1" ] && { echo "Usage: $0 <image-file>"; exit 1; }
|
||||
|
||||
WP_DIR="$HOME/.local/share"
|
||||
finput=$1
|
||||
|
||||
echo -n "making blurred version... "
|
||||
fw=$(magick identify -format "%w\n" $1)
|
||||
fh=$(magick identify -format "%h\n" $1)
|
||||
if [[ $((fw)) > 3840 && $((fh)) > 2160 ]]
|
||||
then
|
||||
finput="/tmp/${finput##*/}"
|
||||
echo "WARNING: image too large, resizing ..."
|
||||
magick $1 -resize "3840x2160^" $finput
|
||||
fi
|
||||
|
||||
echo -n "making blurred version of $finput ... "
|
||||
mkdir -p $WP_DIR
|
||||
cp $1 $WP_DIR/.wallpaper
|
||||
cp $finput $WP_DIR/.wallpaper
|
||||
magick $WP_DIR/.wallpaper -filter Gaussian -blur 0x30 $WP_DIR/.wallpaper_blur
|
||||
echo "Done."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user