It is currently March 28th, 2024, 1:00 pm

imagemagick & RunCommand

Get help with creating, editing & fixing problems with skins
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

imagemagick & RunCommand

Post by StArL0rd84 »

I've got a number of images in a folder that I want to round the corners of.
And I'm using imagemagick to create a mask image, that I then use, to round the corners of all the images in the folder.
it works really well in a CMD window.
But I can't tell why it doesn't work in a runCommand measure.

;navigate to test folder:
cd C:\Users\***USERNAME***\Documents\Rainmeter\Skins\Panels\DownloadFile\test2

;create mask image:
magick convert -size 200x300 xc:none -draw roundrectangle 0,0,200,300,12,12 mask.png

;round corners of ALL images using mask image:
FOR /R %a IN (*.png) DO magick convert "%~a" -matte mask.png -compose DstIn -composite "%~dpna.png"

So I am having a hard time figuring out why it wont create the mask image when I try the same command in Rainmeter.

Code: Select all

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
StartInFolder=C:\Users\***USERNAME***\Documents\Rainmeter\Skins\Panels\DownloadFile\test2
Parameter=magick convert -size 200x300 xc:none -draw roundrectangle 0,0,200,300,12,12 mask.png
State=Show
OutputType=ANSI
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: imagemagick & RunCommand

Post by SilverAzide »

StArL0rd84 wrote: March 12th, 2023, 8:06 pm
Are you literally using ***USERNAME*** in your commands, or is that just a pseudo-code example? You can use the environment variable %USERNAME% in either case.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: imagemagick & RunCommand

Post by StArL0rd84 »

SilverAzide wrote: March 12th, 2023, 11:26 pm Are you literally using ***USERNAME*** in your commands, or is that just a pseudo-code example? You can use the environment variable %USERNAME% in either case.
I just censored that part of the path lol.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany
Contact:

Re: imagemagick & RunCommand

Post by Active Colors »

How does your username looks like? Is it just a Name?
Name with some spaces? Does it contain Non-latin letters, Chinese/Japanese glyphs, Unicode or weird symbols?

Have you tried enclosing the path in quote marks?

Have you tried putting a test image in a short path, like "C:\" ?

Have you tried indicating the path to imagemagik in the measure itself?
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: imagemagick & RunCommand

Post by StArL0rd84 »

Active Colors wrote: March 13th, 2023, 12:03 pm How does your username looks like? Is it just a Name?
Name with some spaces? Does it contain Non-latin letters, Chinese/Japanese glyphs, Unicode or weird symbols?

Have you tried enclosing the path in quote marks?

Have you tried putting a test image in a short path, like "C:\" ?

Have you tried indicating the path to imagemagik in the measure itself?
You put me in the right direction.
Got it working with a short path.
But I could only get it to do it on my D drive, not C.
I then tried to run Rainmeter in Administrator mode, and that did the trick.
Do you know if there's a way to elevate CMD within the measure?

Code: Select all

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
StartInFolder=D:\
Parameter=magick convert -size 200x300 xc:none -draw "roundrectangle 0,0,200,300,12,12" mask.png
State=Show
OutputType=ANSI

EDIT: I hate when it happens, but now it just works, without learning why. Now it works without starting rainmeter in admin mode. But i'll take it.

Code: Select all

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
StartInFolder=#CURRENTPATH#DownloadFile\
Parameter=magick convert -size 200x300 xc:none -draw "roundrectangle 0,0,200,300,12,12" mask.png
State=Show
OutputType=ANSI
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: imagemagick & RunCommand

Post by CodeCode »

Hello

Why are you using ImageMagic?

Wouldnt a shape container be easier?

It could also be dynamic for image dimensions.

:Whistle
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: imagemagick & RunCommand

Post by StArL0rd84 »

CodeCode wrote: March 16th, 2023, 9:10 am Hello

Why are you using ImageMagic?

Wouldnt a shape container be easier?

It could also be dynamic for image dimensions.

:Whistle
Trust me, I know. But the images are all already in a container. And containers cannot be nested 😔
So I had to look for a solution elsewhere.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: imagemagick & RunCommand

Post by balala »

StArL0rd84 wrote: March 16th, 2023, 9:51 am Trust me, I know. But the images are all already in a container. And containers cannot be nested 😔
So I had to look for a solution elsewhere.
What do you mean by "containers cannot be nested" (I don't follow)? In any case, CodeCode's idea on using a Shape meter as container of the images looks definitely better. Not telling that the code would also be much simpler and there would not be needed to involve a .exe file, as you do.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: imagemagick & RunCommand

Post by StArL0rd84 »

balala wrote: March 16th, 2023, 4:48 pm What do you mean by "containers cannot be nested" (I don't follow)? In any case, CodeCode's idea on using a Shape meter as container of the images looks definitely better. Not telling that the code would also be much simpler and there would not be needed to involve a .exe file, as you do.
I originally had shape meters as containers, but I had to scrap that method, because the images are all in a scroll window which is the main container.
So I cannot also use shape meters with the rounded corners for each individual image which would have to be nested in the scroll window too.
I tried...

Containers may not be "nested".
https://docs.rainmeter.net/manual/meters/general-options/container/
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: imagemagick & RunCommand

Post by balala »

StArL0rd84 wrote: March 16th, 2023, 5:16 pm I originally had shape meters as containers, but I had to scrap that method, because the images are all in a scroll window which is the main container.
So I cannot also use shape meters with the rounded corners for each individual image which would have to be nested in the scroll window too.
I tried...
I see. In any case, if you are interested, post a code please. There might be some solution, but I'd need a code, to have to work with.
Post Reply