It is currently March 28th, 2024, 7:59 pm

Masking an image with PreserveAspectRatio=1

Get help with creating, editing & fixing problems with skins
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Masking an image with PreserveAspectRatio=1

Post by chilio »

jsmorley wrote:I don't know of any way. If you create a mask image that is the size and shape of the visualizer meter, then any image you mask into that is going to be made to "fit" inside that. It will just be cropped to fit inside the mask image, but you have no real control over the W and H of the image, only the mask.
In that case, would it be possible to take care of the masking in a plugin? (And could you point me to a place I can read more about making plugins? I'm doing some simple c# + opencl stuff atm, I can try to make a plugin that handles this ^^ (well, it'll probably take me a lot of time, but I don't mind, I'll learn much out of it :) ))
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Masking an image with PreserveAspectRatio=1

Post by balala »

chilio wrote:(And could you point me to a place I can read more about making plugins? I'm doing some simple c# + opencl stuff atm, I can try to make a plugin that handles this ^^ (well, it'll probably take me a lot of time, but I don't mind, I'll learn much out of it :) ))
https://docs.rainmeter.net/developers/#CreatePlugin
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Masking an image with PreserveAspectRatio=1

Post by chilio »

Didn't notice that one, thank you very much! We'll see where I get this to work or not ^^ (will take some time though, and I've got some exams coming up....)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Masking an image with PreserveAspectRatio=1

Post by balala »

chilio wrote:Didn't notice that one, thank you very much! We'll see where I get this to work or not ^^ (will take some time though, and I've got some exams coming up....)
I wish you many success for your exams.
And if you finally do get it to work, post it here on the forum. I'd be also curious....
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Masking an image with PreserveAspectRatio=1

Post by chilio »

balala wrote:I wish you many success for your exams.
And if you finally do get it to work, post it here on the forum. I'd be also curious....
I will try my best! ^^
I mostly wonder if it's possible to use a GPU inside a rainmeter plugin, it should make this idea a whole lot less CPU intensive :)
I will keep you posted =D
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Masking an image with PreserveAspectRatio=1

Post by balala »

chilio wrote:I mostly wonder if it's possible to use a GPU inside a rainmeter plugin, it should make this idea a whole lot less CPU intensive :)
I'm not quite sure I understood what you would like. To use the GPU processing capacity to run the plugin? :confused:
If so, I don't think, but not being programmer, I don't say definitely you can't.
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Masking an image with PreserveAspectRatio=1

Post by chilio »

balala wrote:I'm not quite sure I understood what you would like. To use the GPU processing capacity to run the plugin? :confused:
If so, I don't think, but not being programmer, I don't say definitely you can't.
Jup, seeing I'm trying to do some simple image processing and I just got some tools to get to the GPU, I should at least try it ^^ (but first on the CPU, otherwise I have nothing after miserably failing to target the GPU...)

But first: some sleep :) see you tomorrow!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Masking an image with PreserveAspectRatio=1

Post by balala »

chilio wrote:But first: some sleep :) see you tomorrow!
I agree, :17good me too. Here is midnight.
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Masking an image with PreserveAspectRatio=1

Post by chilio »

Alright, I have most of the basic code in place now:
The input needed:

Code: Select all

[First]
Path
X
Y
W
H
[Second]
Path
X
Y
W
H
[Target]
X
Y
W
H
; A combine mode, where you can choose what you want done. (Will add more later)
Mode = { Mask | Add | Mean }
So if you send this information to the program, it will try to render the target. It needs the X, Y, W, H values to see where each image is. (This gets rid of the PreserveAspectRatio as you'll need to do this for yourself now, will try to insert that later. Lets call it a lazy implementation so far ^^)

I still have a lot of questions though:
1. How does rainmeter load a plugin?
2. How does a skin send the needed information to the plugin?
3. How do I send back the resulting image?
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Masking an image with PreserveAspectRatio=1

Post by chilio »

Oh, I just got some visual feedback =D (it's not great, but I should be able to easily work further from here as the visuals are hacked together (while I actually put in clean code in the image processing))
Knipsel.PNG
This is the mean color of Win 8 default pictures 'city' and 'butterfly', but sadly only the left top corner... I'll give you something better if my uni buddy can wait for so long ^^'

Okey, I got something better, but I can't seem to upload bmp files?

Well, I got a png =D masking went well, I have to work on the preserveRatio though...
masked.png
You do not have the required permissions to view the files attached to this post.