It is currently June 25th, 2019, 6:30 am

background image scaling

Help with creating, editing & fixing problems with skins
User avatar
Pul53dr1v3r
Posts: 173
Joined: July 30th, 2014, 10:30 am

background image scaling

Pul53dr1v3r » April 4th, 2019, 3:14 pm

Hi. Is it possible to scale a bg image in BackgroundMode3 (or in any other that reaqures an image as a bg), using TransformationMatrix setting?

Code: Select all

[Rainmeter]
Author=
AppVersion=
Background=#@#Background.png
BackgroundMode=3
BackgroundMargins=0,34,0,13
AccurateText=1
Last edited by Pul53dr1v3r on April 22nd, 2019, 7:46 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 19268
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: background image scaling

jsmorley » April 4th, 2019, 3:19 pm

Pul53dr1v3r wrote:
April 4th, 2019, 3:14 pm
Hi. Is it possible to scale a bg image in BackgroundMode3 (or in any other that reaqures an image as a bg), using TransformationMatrix setting?

Code: Select all

[Rainmeter]
Author=
AppVersion=
Background=#@#Background.png
BackgroundMode=3
BackgroundMargins=0,34,0,13
AccurateText=1
No, the background image is scaled to fit the size of the skin. It has no independent ability to be sized or scaled.

In any case, TransformationMatrix is a meter option, not a skin option.

If you need more control, including TransformationMatrix, use an Image meter instead.
User avatar
balala
Rainmeter Sage
Posts: 8308
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: background image scaling

balala » April 4th, 2019, 3:24 pm

But you can use an Image meter, which has the image wanted to be used as background. The image can be scaled on a such meter. The only thing you have to take care is to put the Image meter as FIRST meter of the skin. This way it'll be in background, all other meters will be placed over it. You also can set the size of the skin, with SkinWidth and SkinHeight options, placed into the [Rainmeter] section, setting it to the same size as the Image meter.
User avatar
Pul53dr1v3r
Posts: 173
Joined: July 30th, 2014, 10:30 am

Re: background image scaling

Pul53dr1v3r » April 4th, 2019, 7:38 pm

@balala @jsmorley

Thx guys. Seems i got it even though i'm a little bit :? in the last time.

This is how i have done it:

Code: Select all

[Rainmeter]
AppVersion=
Update=1000
Background=#@#Background.png
SkinHeight=(#BgHeight# * #Scale#)
SkinWidth=(#BgWidth# * #Scale#)

[Variables]
FontFamily=Trebuchet MS
textSize=9
colorBar=235,170,0,255
colorText=255,255,255,205
EmptyBarColor=255,255,255,15
Scale=2
BgHeight=68
BgWidth=210
.
.
.
[meterTitle]
Meter=STRING
MeterStyle=styleTitle
StringCase=UPPER
X=104
Y=12
W=100
Text="System UpTime"
TransformationMatrix=#Scale#;0;0;#Scale#;#Scale#;#Scale#
.
.
.
If you see anything wrong pls let me know.

Edit: The Scale will be a dinamyc variable to easily change the whole skin size including bg, fonts, graphs...
User avatar
balala
Rainmeter Sage
Posts: 8308
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: background image scaling

balala » April 4th, 2019, 7:54 pm

Pul53dr1v3r wrote:
April 4th, 2019, 7:38 pm
Edit: The Scale will be a dinamyc variable to easily change the whole skin size including bg, fonts, graphs...
Unfortunately won't work, because the [Rainmeter] section doesn't support dynamic variables (Note here). So, you can't use here the Scale variable if you set it dynamically (with a !SetVariable bang).
User avatar
Pul53dr1v3r
Posts: 173
Joined: July 30th, 2014, 10:30 am

Re: background image scaling

Pul53dr1v3r » April 4th, 2019, 8:35 pm

balala wrote:
April 4th, 2019, 7:54 pm
Unfortunately won't work, because the [Rainmeter] section doesn't support dynamic variables (Note here). So, you can't use here the Scale variable if you set it dynamically (with a !SetVariable bang).
sorry for the bad term "dynamic". I meant to say it will be entered manually by someones wish. If the Scale=1 is a small skin size for someone, he will set it manually to a higher value and save the change.

I wouldn't use the bang if not necessary. Simper the better. :)
User avatar
balala
Rainmeter Sage
Posts: 8308
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: background image scaling

balala » April 4th, 2019, 8:40 pm

Pul53dr1v3r wrote:
April 4th, 2019, 8:35 pm
sorry for the bad term "dynamic". I meant to say it will be entered manually by someones wish. If the Scale=1 is a small skin size for someone, he will set it manually to a higher value and save the change.
Ok, normally, this way it will work.
Pul53dr1v3r wrote:
April 4th, 2019, 8:35 pm
I wouldn't use the bang if not necessary. Simper the better. :)
Usually using the bangs is better (due to the possibility to set things dynamically). But in this case it's nor possible (as described above), nor necessary (probably no one will scale the skin regularly).
User avatar
Pul53dr1v3r
Posts: 173
Joined: July 30th, 2014, 10:30 am

Re: background image scaling

Pul53dr1v3r » April 5th, 2019, 2:48 pm

balala wrote:
April 4th, 2019, 8:40 pm
Ok, normally, this way it will work.
It could pass at a simple skin but here is almost everithyng out of order.
Tested the method on a bit more complicated skin and it caused me a headache:

Image

Also tried using Meter image with ScaleMargins etc. but no success...

Edit: here is the skin if needed:
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 8308
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: background image scaling

balala » April 5th, 2019, 4:06 pm

Note that the background image is already scaled, even when the Scale variable is set to 1. This is caused by the fact that the size of the Background.png image is 210x68 pixels, but in the code the BgHeight variable ([Variables] section) is set to 150. This scales the image and if you set the Scale variable to a greater value then 1 (for example Scale=2), the background is even more distorted.
The best method to handle this probably is to set back the commented out BackgroundMode and BackgroundMargins options into the [Rainmeter] section. For example using the commented out options:

Code: Select all

[Rainmeter]
...
BackgroundMode=3
BackgroundMargins=0,34,0,13
this is what you get:
Skin.png
You do not have the required permissions to view the files attached to this post.
User avatar
Pul53dr1v3r
Posts: 173
Joined: July 30th, 2014, 10:30 am

Re: background image scaling

Pul53dr1v3r » April 5th, 2019, 4:41 pm

balala wrote:
April 5th, 2019, 4:06 pm
Note that the background image is already scaled, even when the Scale variable is set to 1. This is caused by the fact that the size of the Background.png image is 210x68 pixels, but in the code the BgHeight variable ([Variables] section) is set to 150. This scales the image and if you set the Scale variable to a greater value then 1 (for example Scale=2), the background is even more distorted.
The best method to handle this probably is to set back the commented out BackgroundMode and BackgroundMargins options into the [Rainmeter] section. For example using the commented out options:

Code: Select all

[Rainmeter]
...
BackgroundMode=3
BackgroundMargins=0,34,0,13
this is what you get:
Skin.png
Ok, but how to make it properly scale the bg (as the whole skin) in BackgroundMode=3 so that when i turn off the graphs the empty part of the skin disappears, and the bg fits its size according to the content size...? I've no idea if it is even possible...
You do not have the required permissions to view the files attached to this post.