It is currently May 4th, 2024, 4:51 am

Display biggest possible square portion of image

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

Display biggest possible square portion of image

Post by MerlinTheRed »

I have searched the forums a bit and haven't found any similar question, let alone answer, so I'll just ask and hope somebody has an idea:

What I want to do is download an image via WebParser (I know how to do that) and then display the largest possible square portion of it (preferrably centered) in a fixed size. I know how to scale an image meter so it fits into a square. I also know how to crop a fixed size square out of an image. My problem is that I need to do both at once: Cut the largest possible square out of an image and then scale that square to a certain size.

Does anyone have an idea how to accomplish this?
demo_square_crop_scale.png
You do not have the required permissions to view the files attached to this post.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Re: Display biggest possible square portion of image

Post by ~Faradey~ »

MerlinTheRed,
I did it in my slideshow from Kotoko Suite
skin name Kotoko 4.0\Multimedia\SlideShow\Folder_SlideShow\SlideShow-Folder.ini
there you'll find a lua script
hope my coding good for understanding

Sorry i don't have time to make another example. But if you have questions i will answer on them :)
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Display biggest possible square portion of image

Post by MerlinTheRed »

There's a lot going on in that skin of yours, so I'm not sure I understand it right. What I get out of it is something like this:

You display the actual image in an invisible image meter with alpha value 0 and far off the screen. Then you use a Lua script to figure out what size the image is and what portion of the image you need to display. Then you set the ImageCrop on the image meter to cut out the relevant portion. What I don't understand is how you scale that portion to fit into the frame?

If you just give me the general idea I can work from there and figure something out myself.

Thanks for your help.

EDIT: I feel kind of dumb now after discovering that it is actually possible to use both scaling and cropping at the same time. I don't remember why I thought that wouldn't work. Perhaps I misread the manual. In any case I think I know what to do now. Thanks for pointing me into the right direction.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!