Hello,

i have hard time getting ImageMagick COM control to work in powershell script. It works fine in VBScript.

here is what I try:

$img = New-Object -ComObject ImageMagickObject.MagickImage
$msgs = $img.Convert("DSC_0205.JPG", "-resize", "1024x1024", "DSC_0205_out.JPG")

This complains, that "Cannot find an overload for "Convert" and the argument count: "4"."

So I try:

$params = @("DSC_0205.JPG",  "-resize", "1024x1024", "DSC_0205_out.JPG")
$params
$msgs = $img.Convert($params)

And this says, that: "Argument: '1' should be a System.Management.Automation.PSReference. Please use [ref]."

So I try:

$msgs = $img.Convert([ref]$params)

and now all i get it same output as when i run convert.exe without any parameters - the default help text. and, of course, no file converted.

What am i doing wrong here..?:(
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to