[script] Correctly calcul new image size
This commit is contained in:
parent
177c92976a
commit
beabe7e08f
@ -39,18 +39,17 @@ function resize {
|
||||
res=$(xdpyinfo | grep dimensions | awk '{print $2}')
|
||||
tailleX=$(echo $res | awk -F "x" '{print $1}');
|
||||
tailleY=$(echo $res | awk -F "x" '{print $2}');
|
||||
echo "Screen Size is X: $tailleX, Y: $tailleY"
|
||||
# Get image size
|
||||
res=$(identify -format '%w %h\n' $1)
|
||||
imgX=$(echo $res | awk '{print $1}')
|
||||
imgY=$(echo $res | awk '{print $2}')
|
||||
echo "Original Image Size is X: $imgX, Y: $imgY"
|
||||
# Calculate resize factor
|
||||
rapX=$(($tailleX*1000/$imgX))
|
||||
rapY=$(($tailleY*1000/$imgY))
|
||||
echo "Screen Size is X: $tailleX, Y: $tailleY"
|
||||
mult=0
|
||||
div=0
|
||||
if [ $rapX -gt $rapY ];
|
||||
# If using $tailleX and $imgX as factor scale for Y -> use it! It will perfectly fitt for X and do the best for Y
|
||||
if [ $tailleY -gt $((($tailleX*$imgY)/$imgX)) ];
|
||||
then
|
||||
mult=$tailleX
|
||||
div=$imgX
|
||||
@ -100,7 +99,7 @@ fixdbus
|
||||
|
||||
if [[ -e /usr/bin/feh ]]
|
||||
then
|
||||
feh --bg-center $todaywp
|
||||
DISPLAY=:0 feh --bg-center $todaywp
|
||||
fi
|
||||
if [[ -e /usr/bin/xfconf-query ]]
|
||||
then
|
||||
|
Loading…
Reference in New Issue
Block a user