It is currently April 28th, 2024, 4:53 pm

Problem with Image AspectRatio and Trimming

Get help with creating, editing & fixing problems with skins
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Problem with Image AspectRatio and Trimming

Post by MerlinTheRed »

thatsIch wrote: ya but I dont know where it has to be cropped xD
and while you are at it, might you explain me how that works?
I thought crop from x,y to w right and h down of the image
but why would I take the negative of the image-height as X etc?
You know where it has to be cropped because you know the width and height of the image (using [Image:W] and [Image:H]). Then you can calculate the aspect ratio, e.g. using a Calc measure. There you can determine which of the two crop settings you have to use. If you don't want to use Lua, you can store the two lines of code I posted above in variables and then set the appropriate one using !SetOption in the Calc measure that calculates the aspect ratio (using ifActions). It seems that you have lots of images, so using Lua is probably a good idea if you don't want to create a huge number of meters only to determine the correct crop settings.

The CropBorders i posted have a "5" at the end, meaning the coordinates I use are relative to the center of the image, e.g. from -imagewidth/2 to +imagewidth/2 etc. You can also use the top left corner as the origin (default) but then cutting out the right portion from the center of the image isn't as easy.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Problem with Image AspectRatio and Trimming

Post by thatsIch »

MerlinTheRed wrote: You know where it has to be cropped because you know the width and height of the image (using [Image:W] and [Image:H]). Then you can calculate the aspect ratio, e.g. using a Calc measure. There you can determine which of the two crop settings you have to use. If you don't want to use Lua, you can store the two lines of code I posted above in variables and then set the appropriate one using !SetOption in the Calc measure that calculates the aspect ratio (using ifActions). It seems that you have lots of images, so using Lua is probably a good idea if you don't want to create a huge number of meters only to determine the correct crop settings.

The CropBorders i posted have a "5" at the end, meaning the coordinates I use are relative to the center of the image, e.g. from -imagewidth/2 to +imagewidth/2 etc. You can also use the top left corner as the origin (default) but then cutting out the right portion from the center of the image isn't as easy.
Oh I see cause of the centercenter option you need to do that, still not very intuitive reasoning. Hats off for people who understood that part in the manual xD

I'll try it, now that I understand the 5-Option maybe its easier that way =)
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Problem with Image AspectRatio and Trimming

Post by Kaelri »

Here's an easier way than TransformationMatrix to put the original image off-screen:

Code: Select all

[Meter]
Meter=Image
ImageName=image.jpg
X=-[Meter:W]
Y=-[Meter:H]
DynamicVariables=1
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Problem with Image AspectRatio and Trimming

Post by thatsIch »

Kaelri wrote:Here's an easier way than TransformationMatrix to put the original image off-screen:

Code: Select all

[Meter]
Meter=Image
ImageName=image.jpg
X=-[Meter:W]
Y=-[Meter:H]
DynamicVariables=1
ah its just removes them out of "draw" vision right :D
thats smart I guess
Alex Becherer

Re: Problem with Image AspectRatio and Trimming

Post by Alex Becherer »

Kaelri wrote:Here's an easier way than TransformationMatrix to put the original image off-screen:

Code: Select all

[Meter]
Meter=Image
ImageName=image.jpg
X=-[Meter:W]
Y=-[Meter:H]
DynamicVariables=1
wouldn't that make the image visible for one cycle?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Problem with Image AspectRatio and Trimming

Post by Kaelri »

It does in the current beta due to a bug, but that should be fixed this weekend. Sorry, I forgot about that.