It is currently March 28th, 2024, 8:55 pm

Change the SIZE of a Rotating Image

Get help with creating, editing & fixing problems with skins
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Change the SIZE of a Rotating Image

Post by David8192 »

I put a ROTATING Cover Art meter in a container and realized that Some Images are larger than my container. It appears that H and W have no effect on the size of a rotating image. Is there a way around this one?

Code: Select all

[Rainmeter]
Update=500

[Cover]
Measure=NowPlaying
PlayerName=Aimp
PlayerType=Cover

[Loop1]
Measure=Loop
StartValue=1
EndValue=10
Increment=1
LoopCount=0

[dCover]
Meter=Image
ImageName=#@#Images\DBrand
W=160
H=160
Padding=5,5,5,5

[mCover]
Meter=ROTATOR
MeasureName=Loop1
X=0
Y=0
W=160
H=160
ImageName=[Cover]
OffsetX=90
OffsetY=90
StartAngle=(Rad(0))
RotationAngle=(Rad(360))
DynamicVariables=1
Padding=5,5,5,5
Container=dCover
This is my sample image
You do not have the required permissions to view the files attached to this post.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Change the SIZE of a Rotating Image

Post by eclectic-tech »

You can change the size of the image used in Rotator, but you have to know the original image size to calculate the resizing. There is a plugin that can tell you the size of images, but besides finding the image size you would then need to add formulas to resize.

You could use ImageCrop to select the center area of the cover to match the dimensions of your rotator meter, but that method will only show the center 160 pixels of the cover. Adding ImageCrop=-80,-80,160,160,5 to your rotator would give you the center of the cover.

I would recommend using the [Cover] in an Image meter that you CAN resize and then use a TransformationMatrix posted by balala to rotate the image.

This code will use TransformationMatrix to rotate a resized image meter inside your container.

Code: Select all

[Rainmeter]
Update=500

[Variables]
RotationCenterX=90
RotationCenterY=90
Angle=[loop1]

[Cover]
Measure=NowPlaying
PlayerName=Aimp
PlayerType=Cover

[Loop1]
Measure=Loop
StartValue=0
EndValue=330
Increment=30
LoopCount=0
InvertMeasure=1

[dCover]
Meter=Image
ImageName=#@#Images\DBrand
W=160
H=160
Padding=5,5,5,5

[AlbumArt]
Meter=Image
ImageName=[Cover]
x=5
y=5
W=170
H=170
DynamicVariables=1
TransformationMatrix=(Cos(Rad(#Angle#)));(-Sin(Rad(#Angle#)));(Sin(Rad(#Angle#)));(Cos(Rad(#Angle#)));(#RotationCenterX#-#RotationCenterX#*Cos(Rad(#Angle#))-#RotationCenterY#*Sin(Rad(#Angle#)));(#RotationCenterY#+#RotationCenterX#*Sin(Rad(#Angle#))-#RotationCenterY#*Cos(Rad(#Angle#)))
Container=dCover
I added the necessary variables for the matrix. And changed the loop measure to return 360 degree values in 30 degree steps to match your original rotation.
User avatar
Yincognito
Rainmeter Sage
Posts: 7027
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Change the SIZE of a Rotating Image

Post by Yincognito »

Apart from eclectic-tech's reply, be aware that resizing an image when using a low update rate is going to use your CPU / GPU intensively, proportionally with how low that update rate is and the size / size difference of your image. For your settings here, that impact should be reasonable though.

P.S. The above can be done using the ImageRotate option of an image meter as well. The size / position of the rotating meter will vary though for a rezized image, and the values will basically have to do with the particularities of a circle enclosing the image square.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Change the SIZE of a Rotating Image

Post by David8192 »

eclectic-tech wrote: August 8th, 2021, 12:55 am You can change the size of the image used in Rotator, but you have to know the original image size to calculate the resizing. There is a plugin that can tell you the size of images, but besides finding the image size you would then need to add formulas to resize.

I would recommend using the [Cover] in an Image meter that you CAN resize and then use a TransformationMatrix posted by balala to rotate the image.

This code will use TransformationMatrix to rotate a resized image meter inside your container.

Code: Select all

[Rainmeter]
Update=500

[Variables]
RotationCenterX=90
RotationCenterY=90
Angle=[loop1]

[Cover]
Measure=NowPlaying
PlayerName=Aimp
PlayerType=Cover

[Loop1]
Measure=Loop
StartValue=0
EndValue=330
Increment=30
LoopCount=0
InvertMeasure=1

[dCover]
Meter=Image
ImageName=#@#Images\DBrand
W=160
H=160
Padding=5,5,5,5

[AlbumArt]
Meter=Image
ImageName=[Cover]
x=5
y=5
W=170
H=170
DynamicVariables=1
TransformationMatrix=(Cos(Rad(#Angle#)));(-Sin(Rad(#Angle#)));(Sin(Rad(#Angle#)));(Cos(Rad(#Angle#)));(#RotationCenterX#-#RotationCenterX#*Cos(Rad(#Angle#))-#RotationCenterY#*Sin(Rad(#Angle#)));(#RotationCenterY#+#RotationCenterX#*Sin(Rad(#Angle#))-#RotationCenterY#*Cos(Rad(#Angle#)))
Container=dCover
I added the necessary variables for the matrix. And changed the loop measure to return 360 degree values in 30 degree steps to match your original rotation.
Thank you eclectic-tech. It is exactly what I wanted. :bow:
Yincognito wrote: August 8th, 2021, 10:21 am Apart from eclectic-tech's reply, be aware that resizing an image when using a low update rate is going to use your CPU / GPU intensively, proportionally with how low that update rate is and the size / size difference of your image. For your settings here, that impact should be reasonable though.
I noticed that, but it is a fair change.
Yincognito wrote: August 8th, 2021, 10:21 am P.S. The above can be done using the ImageRotate option of an image meter as well. The size / position of the rotating meter will vary though for a rezized image, and the values will basically have to do with the particularities of a circle enclosing the image square.
I wanted to keep all image sizes fixed to fit in the container.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
Yincognito
Rainmeter Sage
Posts: 7027
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Change the SIZE of a Rotating Image

Post by Yincognito »

David8192 wrote: August 8th, 2021, 11:59 amI wanted to keep all image sizes fixed to fit in the container.
Of course, but just so you know, the image "size" is not the same as the meter "size", in an image rotating scenario. In other words, while the (rotated) image size will stay the same in such a case, the meter size will always vary, depending on the angle of rotation. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Change the SIZE of a Rotating Image

Post by David8192 »

Yincognito wrote: August 8th, 2021, 10:21 am P.S. The above can be done using the ImageRotate option of an image meter as well.
I will try this for a variation.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
Yincognito
Rainmeter Sage
Posts: 7027
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Change the SIZE of a Rotating Image

Post by Yincognito »

David8192 wrote: August 8th, 2021, 4:08 pm I will try this for a variation.
You don't need to, it's more complicated than that - better stick with eclectic-tech's code for now. I was just saying so that you know there's an alternative, that's all. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Change the SIZE of a Rotating Image

Post by David8192 »

Yincognito wrote: August 8th, 2021, 4:13 pm You don't need to, it's more complicated than that - better stick with eclectic-tech's code for now. I was just saying so that you know there's an alternative, that's all. ;-)
:great:

Oh, I am not changing the one eclectic-tech did. It's awesome.

I just felt like experimenting with your idea to see where it would lead me.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
Yincognito
Rainmeter Sage
Posts: 7027
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Change the SIZE of a Rotating Image

Post by Yincognito »

David8192 wrote: August 8th, 2021, 7:10 pmI just felt like experimenting with your idea to see where it would lead me.
Ah ok, you can definitely do that. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Change the SIZE of a Rotating Image

Post by balala »

Yincognito wrote: August 8th, 2021, 12:10 pm In other words, while the (rotated) image size will stay the same in such a case, the meter size will always vary, depending on the angle of rotation. ;-)
No, in fact the size of the meter doesn't vary either. Just its "visible" size varies. And there is a difference between these. I hope you know what am I talking about.