![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest
Posts: n/a
| Using ImageMagick COM object 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..? ![]() |
| | #2 (permalink) | ||||||||||||
| Guest
Posts: n/a
| Re: Using ImageMagick COM object Algirdas wrote:
to get-member: PSH>$img|get-member An exception was thrown when trying to enumerate the collection: "Object reference not set to an instance of an object. ". At line:1 char:5 + $img <<<< Now, PowerShell's COM implementation has some issues. I would try: 1. You could call VBScript code form PowerShell, but that defeats the purpose in most cases. -or- 2. Try using ImageMagick's .NET assembly from PowerShell. Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com | ||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||||||||||||||
| Guest
Posts: n/a
| Re: Using ImageMagick COM object
now). Just wanted to make it more slick.
| ||||||||||||||||||||||||||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||
| Guest
Posts: n/a
| Re: Using ImageMagick COM object
It seems pretty immature... A pre-compiled DLL doesn't seem to be provided. I provided the information without actually reading all the details... Marco | ||||||||||||||||||||||||
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare-Object and Get the name of object/File? | akcorr | PowerShell | 5 | 06-19-2008 05:15 AM |
| Re: Unable to cast COM object of type 'ADODB.RecordsetClass' to class type 'System.Object[]' | Michel Posseth [MCP] | .NET General | 2 | 03-27-2008 10:04 AM |
| Testing object arrays using Compare-Object and -contains | Alex K. Angelopoulos [MVP] | PowerShell | 2 | 08-31-2006 05:57 PM |
| Adding canonical aliases for Compare-Object, Measure-Object, New-Object | Alex K. Angelopoulos [MVP] | PowerShell | 2 | 05-26-2006 07:58 AM |