From 4a4137e11cd59781af2df4165c494728967e12ca Mon Sep 17 00:00:00 2001 From: bob8677 <11bob8677@gmail.com> Date: Sat, 10 Apr 2021 17:35:41 -0500 Subject: [PATCH 1/3] add logo blur option --- wallutils.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/wallutils.sh b/wallutils.sh index d51db29..03e7a56 100644 --- a/wallutils.sh +++ b/wallutils.sh @@ -142,22 +142,31 @@ compwallpaper() { instantoverlay imgresize overlay.png "$RESOLUTION" + # perpare effects + case $(iconf logoeffects) in + "invert") + convert wall.png -channel RGB -negate effect.png + ;; + "blur") + convert wall.png -blur 100x100 effect.png + ;; + "both") + convert wall.png -blur 100x100 -channel RGB -negate effect.png + ;; + esac + # create mask from overlay convert overlay.png -alpha extract mask.png - # cut the image with the mask - composite -compose CopyOpacity mask.png wall.png cut.png - # Convert to black and white the cut - # convert cut.png -colorspace Gray blackandwhite.png - # Negate the black and white cut - convert cut.png -channel RGB -negate invert.png + # cut the effect image with the mask + composite -compose CopyOpacity mask.png effect.png cut.png # draw the computed overlay on top of the background - convert wall.png invert.png -gravity center -composite instantwallpaper.png + convert wall.png cut.png -gravity center -composite instantwallpaper.png rm wall.png rm mask.png rm cut.png rm blackandwhite.png - rm invert.png + rm effect.png else echo "logo disabled" mv wall.png instantwallpaper.png From 0ac0b0fc1a274cd58c555d97097715c3cebb6e2e Mon Sep 17 00:00:00 2001 From: bob8677 <11bob8677@gmail.com> Date: Sun, 11 Apr 2021 12:44:06 -0500 Subject: [PATCH 2/3] make logo effects more scalable + add more options --- wallutils.sh | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/wallutils.sh b/wallutils.sh index 03e7a56..5c7c3bf 100644 --- a/wallutils.sh +++ b/wallutils.sh @@ -142,18 +142,17 @@ compwallpaper() { instantoverlay imgresize overlay.png "$RESOLUTION" - # perpare effects - case $(iconf logoeffects) in - "invert") - convert wall.png -channel RGB -negate effect.png - ;; - "blur") - convert wall.png -blur 100x100 effect.png - ;; - "both") - convert wall.png -blur 100x100 -channel RGB -negate effect.png - ;; - esac + # perpare effect settings + iconf logoeffects | grep swirl && EFFECTS+=("-swirl" "360") + iconf logoeffects | grep flip && EFFECTS+=("-flip") + iconf logoeffects | grep blur && EFFECTS+=("-blur" "100x100") + iconf logoeffects | grep invert && EFFECTS+=("-channel" "RGB" "-negate") + iconf logoeffects | grep grayscale && EFFECTS+=("-colorspace" "Gray") + iconf logoeffects | grep contrast && EFFECTS+=("-level" "20000") + iconf logoeffects | grep dim && EFFECTS+=("-modulate" "50") + iconf logoeffects | grep brighten | grep -v dim && EFFECTS+=("-modulate" "150") + + convert wall.png "${EFFECTS[@]}" effect.png # create mask from overlay convert overlay.png -alpha extract mask.png @@ -165,7 +164,6 @@ compwallpaper() { rm wall.png rm mask.png rm cut.png - rm blackandwhite.png rm effect.png else echo "logo disabled" From 78b661be8434c5fd41b58adaf897bbff1f801112 Mon Sep 17 00:00:00 2001 From: bob8677 <11bob8677@gmail.com> Date: Sun, 11 Apr 2021 16:14:55 -0500 Subject: [PATCH 3/3] set effect to invert if not set --- wallutils.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wallutils.sh b/wallutils.sh index 5c7c3bf..e864934 100644 --- a/wallutils.sh +++ b/wallutils.sh @@ -142,6 +142,12 @@ compwallpaper() { instantoverlay imgresize overlay.png "$RESOLUTION" + # set to invert if logoeffects is not set or broken + iconf logoeffects | + grep -E 'brighten|dim|contrast|grayscale|invert|blur|flip|swirl' || + iconf logoeffects 'invert' + + # perpare effect settings iconf logoeffects | grep swirl && EFFECTS+=("-swirl" "360") iconf logoeffects | grep flip && EFFECTS+=("-flip") @@ -152,6 +158,7 @@ compwallpaper() { iconf logoeffects | grep dim && EFFECTS+=("-modulate" "50") iconf logoeffects | grep brighten | grep -v dim && EFFECTS+=("-modulate" "150") + # apply effects convert wall.png "${EFFECTS[@]}" effect.png # create mask from overlay