It is currently April 19th, 2024, 6:21 pm

Working with Bitmap

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with Bitmap

Post by jsmorley »

Maybe this would be easier if you just use an Image meter instead of a Bitmap meter.

So create 135 (or however many you want) entirely separate images, one for each "frame". Number them from 1-135. Put them in some folder.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!Move "0" "0"][!Zpos "1"][!CommandMeasure MeasureAction "Execute 1"]

[MeasureCount]
Measure=Loop
StartValue=1
EndValue=135
UpdateDivider=-1
Paused=1

[MeasureAction]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Start | Wait 10 | Repeat CountUp,16,135 | Wait 10 | Stop
Start=[!UnpauseMeasure MeasureCount]
CountUp=[!UpdateMeasure MeasureCount][!UpdateMeter MeterImage][!Redraw]
Stop=[!PauseMeasure MeasureCount]

[MeterImage]
Meter=Image
ImageName=#@#ImageFrames\Image[MeasureCount].png
DynamicVariables=1
xames3
Posts: 10
Joined: April 29th, 2018, 9:10 am

Re: Working with Bitmap

Post by xames3 »

I somewhat got the math behind using bitmap frames but now in this example, I've used 101160x156 image each frame is 562px wide doing the above mentioned math 101160/562 = 180 then I should use
EndValue=180
ActionList1=Start | Wait 10 | Repeat CountUp,16,180 | Wait 10 | Stop
BitmapFrames = 180
right?
It is not working that way either :oops: :???: :confused: :confused:
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with Bitmap

Post by jsmorley »

xames3 wrote:I somewhat got the math behind using bitmap frames but now in this example, I've used 101160x156 image each frame is 562px wide doing the above mentioned math 101160/562 = 180 then I should use
EndValue=180
ActionList1=Start | Wait 10 | Repeat CountUp,16,180 | Wait 10 | Stop
BitmapFrames = 180
right?
It is not working that way either :oops: :???: :confused: :confused:
The logic there is right, but I don't think how you are creating the bitmap image is working as you expect. You might try using an Image meter as I described above.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with Bitmap

Post by jsmorley »

At the end of the day, this is pushing Rainmeter I lot harder than I ever would. Loading a gigantic 135 frame X 1920 bitmap image will take Rainmeter a while to accomplish and do the initial work creating the Bitmap meter. Loading 135 separate 1920 X 1080 images one after another and displaying them at 16ms intervals is going to cause it to be really "slow" the first time through, as it loads and caches the images, and might even have a hard time "keeping up" with doing that at 16ms intervals 135 times.

Rainmeter is just not going to like dealing with that many "full screen" images, and certainly not at that speed.
xames3
Posts: 10
Joined: April 29th, 2018, 9:10 am

Re: Working with Bitmap

Post by xames3 »

Tried this method as well but not able to get last frame. Yes I understand now that rainmeter won't be able to use fullscreen animation as a daily driver. I'll definitely work on that but using the small image isn't helping me. what is wrong with me?! :?
The animation loads for the first time and then it disappears and replays after refreshing the skin and then disappears again...
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with Bitmap

Post by jsmorley »

Performance issues aside, and they are not going to be trivial, if you use this code:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!Move "0" "0"][!Zpos "1"][!CommandMeasure MeasureAction "Execute 1"]

[MeasureCount]
Measure=Loop
StartValue=1
EndValue=135
UpdateDivider=-1
Paused=1

[MeasureAction]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Start | Wait 10 | Repeat CountUp,16,135 | Wait 10 | Stop
Start=[!UnpauseMeasure MeasureCount]
CountUp=[!UpdateMeasure MeasureCount][!UpdateMeter MeterImage][!Redraw]
Stop=[!PauseMeasure MeasureCount]

[MeterImage]
Meter=Image
ImageName=#@#ImageFrames\Image[MeasureCount].png
DynamicVariables=1
And have your images named Image.png, Image2.png, ... Image135.png, I assure you it will at least attempt to display each of them in order, and will end up with Image135.png displayed.
xames3
Posts: 10
Joined: April 29th, 2018, 9:10 am

Re: Working with Bitmap

Post by xames3 »

jsmorley wrote:Performance issues aside, and they are not going to be trivial, if you use this code:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!Move "0" "0"][!Zpos "1"][!CommandMeasure MeasureAction "Execute 1"]

[MeasureCount]
Measure=Loop
StartValue=1
EndValue=135
UpdateDivider=-1
Paused=1

[MeasureAction]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Start | Wait 10 | Repeat CountUp,16,135 | Wait 10 | Stop
Start=[!UnpauseMeasure MeasureCount]
CountUp=[!UpdateMeasure MeasureCount][!UpdateMeter MeterImage][!Redraw]
Stop=[!PauseMeasure MeasureCount]

[MeterImage]
Meter=Image
ImageName=#@#ImageFrames\Image[MeasureCount].png
DynamicVariables=1
And have your images named Frame1.png, Frame2.png, ... Frame135.png, I assure you it will at least attempt to display each of them in order, and will end up with Frame135.png displayed.
Yup used the real name of the images...Animation is working smoothly i want it to stay on the last frame after its done "animating". Should I share the folder with you?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with Bitmap

Post by jsmorley »

Sure, and your code.
xames3
Posts: 10
Joined: April 29th, 2018, 9:10 am

Re: Working with Bitmap

Post by xames3 »

Got it working!!!!!!!!
Thanks man!!!!!!!!!!
Only one more query... is it going to cause issue with performance, because it is just a start I'm thinking of using alot of animations in future on top of this... I'm using a 16 gb ram laptop with core i7 - 7700 hq
Also how can I add other animations on top of this with those having some delay in their activation?

One more - isn't there other method of using the images as I would need to create a hell lot of folders with lot of frames in my resources folder. why didn't the bitframe method worked for me?

And thanks a lot for staying with me for so long on this very basic thing. Appreciate your time man!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with Bitmap

Post by jsmorley »

xames3 wrote:Got it working!!!!!!!!
Thanks man!!!!!!!!!!
Only one more query... is it going to cause issue with performance, because it is just a start I'm thinking of using alot of animations in future on top of this... I'm using a 16 gb ram laptop with core i7 - 7700 hq
Also how can I add other animations on top of this with those having some delay in their activation?
Animations driven on a one-time basis, or only on a mouse click or something, using the ActionTimer plugin to drive things, won't in and of itself be a problem with performance. But I caution that loading very large images, and particularly when you are driving the "repeat" at a very fast pace like 16ms, is going to be an issue. Not so much with CPU usage, you have lots of CPU with that system, and after all it's only one-time or on demand, but the shear act of "loading" a ton of really large images one after the other at 16ms intervals is likely going to cause some "lag" behavior with Rainmeter. Its really going to have a hard time getting a single large image all loaded from disk and cached into memory in 16ms, when the next request, to do the next one, is going to follow right behind.