If I have an image like this:
This image is 1080 X 680 And I want to crop off that black information border at the bottom and everything to the right of the international date line on the right, I would need to know how many pixels big the original image is, and how it big would be without those areas.
Lots of ways to do that I guess, but I just loaded the original image into an image editor (I used Photoshop, but most things will work) and manually "cropped" the image to the content I wanted. I now know the size of the "cropped" image. That size is the stuff I want to "keep" from the original image.
ImageCrop is used to define what you want to "keep", not what you want to "remove".
This image is 977 X 644 Note that I used a copy of the actual image downloaded to %TEMP% by your skin, so these measurements will work for you, and you can skip that first bit... It's important that you know "how and why" I did it though, for future reference.
Now I have the information I need... I create a skin like:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
; Original image is 1080 X 680
; Manually cropped image is 977 X 644
; So we want to display 977 of the width and
; 644 of the height of the original image
; starting at the top left of the image
; to crop it in Rainmeter to the desired content
; We move the image in (X) and down (Y) by 10 pixels, to allow for our border
; We then crop the image to the desired content, using ImageCrop
; Then we size the cropped image to our desired width, using
; PreserveAspectRatio=1 so we don't squish or stretch it
[MeterImage]
Meter=Image
X=10
Y=10
ImagePath=#@#Images\
ImageName=GMSIR0.
ImageCrop=0,0,977,644
W=400
PreserveAspectRatio=1
; Now we add our border around the image. I refuse to use an Image meter for this,
; it just adds more complexity to the "sizing" that I dont' need. So I'm using a Shape meter.
; I know I want a border width of 10 pixels, and that a stroke is half-inside and half-outside
; the shape, so I first move the Rectangle in and down by 5 pixels (half). That
; is the Rectangle=5,5 bit.
; Then I set the width and height of the rectangle to the current width and height
; of the Image meter, plus 10 pixels.
[MeterBorder]
Meter=Shape
Shape=Rectangle 5,5,([MeterImage:W]+10),([MeterImage:H]+10) | StrokeWidth 10 | Stroke Color 47,47,47,255 | Fill Color 0,0,0,1
DynamicVariables=1