feat: Update hypr config

This commit is contained in:
2025-10-22 22:21:09 +11:00
parent 6d3b2e7445
commit 7f9b095859
5 changed files with 37 additions and 51 deletions

View File

@@ -291,25 +291,25 @@ else
fi
# test input image
convert -quiet "$infile" $bricon -clamp +repage "$tmpA1" ||
magick -quiet "$infile" $bricon -clamp +repage "$tmpA1" ||
errMsg "--- FILE $infile DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---"
# test spot file if exists
if [ "$spotfile" != "" ]; then
convert -quiet "$spotfile" -alpha off +repage "$tmpA2" ||
magick -quiet "$spotfile" -alpha off +repage "$tmpA2" ||
errMsg "--- FILE $spotfile DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---"
fi
# get image width, height and aspect
ww=`convert $tmpA1 -ping -format "%w" info:`
hh=`convert $tmpA1 -ping -format "%h" info:`
ww=`magick $tmpA1 -ping -format "%w" info:`
hh=`magick $tmpA1 -ping -format "%h" info:`
# get size of spot and center of spot and last pixel of spot and pad size
if [ "$spotfile" = "" ]; then
sw=`echo $size | cut -dx -f1`
sh=`echo $size | cut -dx -f2`
scx=`convert xc: -format "%[fx:($sw-1)/2]" info:`
scy=`convert xc: -format "%[fx:($sh-1)/2]" info:`
scx=`magick xc: -format "%[fx:($sw-1)/2]" info:`
scy=`magick xc: -format "%[fx:($sh-1)/2]" info:`
lx=$((sw-1))
ly=$((sh-1))
@@ -318,8 +318,8 @@ if [ "$spotfile" = "" ]; then
ph=$((sh+2*pad))
else
pw=`convert $tmpA2 -ping -format "%w" info:`
ph=`convert $tmpA2 -ping -format "%h" info:`
pw=`magick $tmpA2 -ping -format "%w" info:`
ph=`magick $tmpA2 -ping -format "%h" info:`
fi
@@ -332,19 +332,19 @@ if [ "$spotfile" = "" ]; then
# create spot template
if [ "$type" = "circle" ]; then
convert -size ${sw}x${sh} xc:black \
magick -size ${sw}x${sh} xc:black \
+antialias -fill white -draw "ellipse $scx,$scy $scx,$scy 0,360" -alpha off \
$padding \
$tmpA2
elif [ "$type" = "square" ]; then
convert -size ${sw}x${sh} xc:black \
magick -size ${sw}x${sh} xc:black \
+antialias -fill white -draw "rectangle 0,0 $lx,$ly" -alpha off \
$padding \
$tmpA2
elif [ "$type" = "diamond" ]; then
convert -size ${sw}x${sh} xc:black \
magick -size ${sw}x${sh} xc:black \
+antialias -fill white -draw "polygon $scx,0 $lx,$scy $scx,$ly 0,$scy" -alpha off \
$padding \
$tmpA2
@@ -352,22 +352,22 @@ if [ "$spotfile" = "" ]; then
fi
# compute xmin and ymin and virtual canvas size
xmin=`convert xc: -format "%[fx:ceil($ww/$pw)]" info:`
ymin=`convert xc: -format "%[fx:ceil($hh/$ph)]" info:`
www=`convert xc: -format "%[fx:$xmin*$pw]" info:`
hhh=`convert xc: -format "%[fx:$ymin*$ph]" info:`
xmin=`magick xc: -format "%[fx:ceil($ww/$pw)]" info:`
ymin=`magick xc: -format "%[fx:ceil($hh/$ph)]" info:`
www=`magick xc: -format "%[fx:$xmin*$pw]" info:`
hhh=`magick xc: -format "%[fx:$ymin*$ph]" info:`
# process image
if [ "$edge" = "0" ]; then
convert \( $tmpA1 -define distort:viewport=${www}x${hhh}+0+0 -virtual-pixel mirror -distort SRT 0 \
magick \( $tmpA1 -define distort:viewport=${www}x${hhh}+0+0 -virtual-pixel mirror -distort SRT 0 \
-scale ${xmin}x${ymin}! -scale ${www}x${hhh}! -crop ${ww}x${hh}+0+0 +repage \) \
\( $tmpA2 -write mpr:tile +delete -size ${ww}x${hh}! tile:mpr:tile \) \
-alpha off -compose copy_opacity -composite -compose over \
-background $bgcolor -flatten \
"$outfile"
else
convert \( $tmpA1 -define distort:viewport=${www}x${hhh}+0 -virtual-pixel mirror -distort SRT 0 \
magick \( $tmpA1 -define distort:viewport=${www}x${hhh}+0 -virtual-pixel mirror -distort SRT 0 \
-scale ${xmin}x${ymin}! -scale ${www}x${hhh}! -crop ${ww}x${hh}+0+0 +repage \) \
\( $tmpA2 -write mpr:tile +delete -size ${ww}x${hh}! tile:mpr:tile \) \
\( -clone 1 -threshold 0 -edge $edge -clamp -fill $ecolor -opaque white -transparent black \) \