Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logo blur option #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions wallutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,36 @@ 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")
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")

# apply effects
convert wall.png "${EFFECTS[@]}" effect.png

# 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
Expand Down