It is currently November 30th, 2021, 3:18 am

Blur Backgrounds for Skins/Meters

Tips and Tricks from the Rainmeter Community
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4497
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Blur Backgrounds for Skins/Meters

Post by eclectic-tech »

Blur Backgrounds for Skins/Meters

Something that has been missing since Windows 7 and not yet included in later Windows updates.

I spent some time working with the MagickMeter plugin, trying different methods to achieve blurred backgrounds, and through a lot of trial and error, I am happy to share an alternative method to have blurred backgrounds.

This may seems complicated, but actually uses only a small portion of ImageMagick's tools to achieve blurs.

Read on!
An example package is included at the end. :D

Due to some undesirable side effects of the FrostedGlass plugin on some systems and until Windows offers a blur feature, here is a method using the MagickMeter plugin by Khanhas to create blur backgrounds images for skins/meters.

You will need to follow the instructions on Khanhas's page if you do not already have ImageMagick installed and added to your path. It might help to also install his example package which will install the MagickMeter plugin in Rainmeter.

Note: ImageMagick has literally hundreds of commands and parameters, and it is easy to be overwhelmed by all of those.
Luckily, you only need to understand and use a few of those commands:
'Screenshot', 'ExportTo', 'File', 'Clone', 'Crop', and 'Blur'.

Preliminary Steps
Install ImageMagick from Khanhas's page link above
Install his example package (which installs the MagickMeter plugin)

QUICK ACTIONS OVERVIEW
Create your skin in which you:
Create a screenshot of the current desktop. (I do this in a separate skin)
Create MagickMeter measure in your skin to create images from portions of that screenshot for meters
Monitor the current skin position and refresh when that changes
Monitor the wallpaper and re-sync when it changes

MEASURE/METER DETAILS
These are the steps (with caveats and advantages) to use MagickMeter plugin measure to create blurred backgrounds for skins/meters.

Step 1.) Use the MagickMeter plugin to capture the current desktop image (a 'Screenshot' command) and save it ('ExportTo' command) in @Resources for use by a 'File' command in other MagickMeter measures. This done when the skin loads.

An example MagickMeter measure to capture a screenshot (after all windows and skins are hidden) and save it to a file:

Code: Select all

; Take a screenshot of the current desktop and save it for use in MagickMeters
[mWallpaper]
Measure=Plugin
Plugin=MagickMeter
Image=File Screenshot | Ignore 1
Image2=Clone Image
ExportTo=#@#WallImage.png
OnFinishAction=[!DeactivateConfig]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
blurbar0.png
Caveats:
A.) (Auto-resync was added in V 1.2021.11.04) This needs the inclusion of an end user action to hide all open windows before capturing the screenshot. Also, the skin should use a 'hide-all-active skins' bang prior to the capture; [!Hide *]. Hiding open windows might be done automatically using a vbscript:

Code: Select all

set oShellApp = CreateObject("Shell.Application")

oShellApp.MinimizeAll
B.) A 'OnFinishAction' may be needed on the MagickMeter measure to show all the skins that were hidden for the screenshot. This may show some skins the user may have had hidden prior; this should not be a problem for a suite of skins, but skins from other packages may need to be modified to react.

C.) Windows lets user select any of 6 different methods to display wallpaper: Fit, Fill, Tile, Center, Stretch, and Span. This prevents using an unaltered copy of your wallpaper image as the source for blurring.

Advantage:
A.) Using MagickMater's 'Screenshot' command lets you capture the actual desktop as re-dimensioned by Windows display settings.

B.) This only has to be done when the skin is initially loaded or when the desktop changes. There is an option in the context menu to resymc anytime.

You can add tests to detect desktop changes and you can add an option to manually initiate the process of recapturing the desktop screenshot.
A monitor measure using SysColor plugin by Brian to detect changes in the desktop accent color

Code: Select all

[MeasureColorTrigger]
Measure=Plugin
Plugin=SysColor
ColorType=DWM_COLOR
DisplayType=RGB
OnChangeAction=[!UpdateMeasure mDesktop][!Delay 3500][!ActivateConfig "#RootConfig#\Resync" "ResyncWallpaper.ini"]
DynamicVariables=1
Step 2.) Create a MagickMeter measure in your skin using 'File' to 'Clone' a 'Crop'ped portion of the saved 'Screenshot' image as the meter background. In that measure you define the dimensions of the cloned meter image and control the level of 'Blur'.

An example MagickMeter measure to create an image for use as background using a cropped portion of the saved screenshot

Code: Select all

; Create a blur background for your back meter
; =================================
[MagickMeter1]
Measure = Plugin
Plugin = MagickMeter
Image = File #@#WallImage.png | Crop #CurrentConfigX#, #CurrentConfigY#, #ScreenAreaWidth#, #BarHeight#
Image2 = Clone Image | Blur 0,#Sigma#
OnFinishAction=[!Show *]
UpdateDivider=-1
Caveats:

A.) You need to monitor the current skin position and refresh when it moves. Monitoring #CurrentConfigX# and #CurrentConfigY# built-in variables after setting #ConfigX# / #ConfigY# variables (if both are needed) make this a simple 'IfCondition' test. When it changes, you update the MagickMeter measure and meters and redraw; you do not need to recapture the desktop.

A sample IfCondition test to monitor a skin's screen position then update and redraw

Code: Select all

; Delayed reaction to allow repositioning skin before re-syncing blur region
[mConfigY]
Measure=Calc
Formula=#CURRENTCONFIGY#
IfCondition=([mConfigY]<>#ConfigY#)
IfTrueAction=[!SetVariable ConfigY [#CURRENTCONFIGY]][!ShowMeterGroup NewPicture][!Redraw][!Delay 1000][!CommandMeasure MagickMeter1 "Update"][!UpdateMeter Back][!HideMeterGroup NewPicture][!Redraw]
IfConditionMode=1
UpdateDivider=5
DynamicVariables=1
MagickMeter can do many other image manipulations but for blur this is all you really need.
That covers most of what you might need to be aware of to use this plugin.

So...
blurbar2.png
Here is a package that shows how I use these methods in a suite of several skins.
When first loaded, It will open a skin that will auto-resync in 10 seconds, minimize all open windows, hide all skins, then capturing your current desktop image.
Then it will open the actual 'bar' skin with a blur background.
To restore minimized skins, press 'Win+Shift+M' or select that from the taskbar right-click options.
It includes a media player skin and a weather skin, along with other display options.

Feel free to dig into it and start blurring your meters.

Questions or ideas welcomed.

Latest changes:
Thanks to member 'Jeff' for suggestions on expanding MagickMeter effects! :rosegift:
I removed all of my test meters, so now the skins update after a few seconds without any messages or coverings.

Blur Bar_1.2021.11.04.rmskin
You do not have the required permissions to view the files attached to this post.
User avatar
Jeff
Posts: 239
Joined: September 3rd, 2018, 11:18 am

Re: Blur Backgrounds for Skins/Meters

Post by Jeff »

Aiding a bit to this thread, based on this, you could recreate Acrylic with something like

Code: Select all

Acrylic=| Modulate 100,150,100 | GaussianBlur 0,10 | Colorize 25;FFFFFF | Noise 1,3 
; and for the other effects
Blur=| Modulate 100,150,100 | GaussianBlur 0,5 | Colorize 25;FFFFFF
None=| InnerShadow 50,2,20,20

; and for the Image2 you just have
Image2= Clone Image #Acrylic#
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4497
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Blur Backgrounds for Skins/Meters

Post by eclectic-tech »

Nice addition Jeff!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4497
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Blur Backgrounds for Skins/Meters

Post by eclectic-tech »

Thanks again for the options Jeff.

After trying those, I find the Acrylic is close to Windows Taskbar blur, but is a bit too blurry for my taste.

I also modified the Blur and InnerShadow option (which does give a nicely defined edge to the skins) but uses a selectable blur #Sigma#, and removes the colorize (I didn't care for that :p ).

Code: Select all

Blur=| Modulate 100,100,100 | Blur 0,#Sigma#
; | Colorize 25;FFFFFF
EdgeShadow=| InnerShadow 50,#Sigma#,0,0
blurbar2.png
I have been testing an auto-resync skin that is working well and I will add your additions to my next update.

EDIT: Auto-resync and expanded effect options added.
Download V 1.2021.11.04 in first post.

Thanks again! :thumbup:
You do not have the required permissions to view the files attached to this post.