It is currently July 4th, 2022, 5:21 am

Formulas do not work in ImageCrop

Report bugs with the Rainmeter application and suggest features.
TurboSlayer
Posts: 2
Joined: May 25th, 2022, 5:05 pm

Formulas do not work in ImageCrop

Post by TurboSlayer »

Formulas do not work in ImageCrop. I am not sure what value it uses instead of the formula, but from my experience it seems to use 0 as the value.

Example of code that works:
ImageCrop=0, 0, 5, 181, 1

Example of code that does not work (uses 0 instead):
ImageCrop=0, 0, 5, (180), 1
ImageCrop=0, 0, 5, (180 + 1), 1
ImageCrop=0, 0, 5, (#Var# + 180), 1

The documentation for formulas says that formulas can be used "as a numeric part of an option value", and this is the example:
FontColor=(255 * 0.5),255,255,255

However, this doesn't seem to work with ImageCrop, and the only way around it is to calculate the result first using a Calc measure or by doing it manually. Any help would be appreciated.
User avatar
balala
Rainmeter Sage
Posts: 14338
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Formulas do not work in ImageCrop

Post by balala »

TurboSlayer wrote: May 25th, 2022, 5:19 pm Formulas do not work in ImageCrop.
They are, just remove the spaces outside of the formulas, from the options. All of the following ones are working:
ImageCrop=0,0,5,(180),1
ImageCrop=0,0,5,(180+1),1
ImageCrop=0,0,5,(#Var#+180),1
Additionally even the following ones are working:
ImageCrop=0,0,5,(180 + 1),1
ImageCrop=0,0,5,(#Var# + 180),1
If there are no formulas, the spaces can be used. That's why the ImageCrop=0, 0, 5, 181, 1 option is working.
TurboSlayer
Posts: 2
Joined: May 25th, 2022, 5:05 pm

Re: Formulas do not work in ImageCrop

Post by TurboSlayer »

Ah I see. Thanks for the solution - I'll test it out right now.
User avatar
death.crafter
Rainmeter Sage
Posts: 1367
Joined: April 24th, 2021, 8:13 pm

Re: Formulas do not work in ImageCrop

Post by death.crafter »

This is a bug though. :oops:
from the Realm of Death
Bekarfel
Posts: 204
Joined: May 16th, 2012, 5:38 am

Re: Formulas do not work in ImageCrop

Post by Bekarfel »

It's at the very least inconsistent behavior.
moshi wrote:there are many Rainmeter skins that aren't really useful, so let's add another one.
jsmorley wrote:I have good news and bad news.
First the bad news. [...] We would be happy to have this happen and would love to work with anyone who is feeling ambitious.
Now the good news.
I lied, there isn't any good news...