Jump to content

ImageMagick Object


ptrex
 Share

Recommended Posts

@oldschool

Try to run to commands like this from the CONVERT.EXE :

ShellExecute("convert.exe", "cyclops.png \( +clone -fx 'p{0,0}' \) \ -compose Difference  -composite  \ " _
             "-modulate 100,0  +matte  difference.png", "C:\Program Files\ImageMagick-6.3.5-Q16\")

If that works you ccan start bringing over the syntax to the COM syntax.

This is the only way you can start debugging the syntax.

regards

ptrex

Link to comment
Share on other sites

@oldschool

Try to run to commands like this from the CONVERT.EXE :

ShellExecute("convert.exe", "cyclops.png \( +clone -fx 'p{0,0}' \) \ -compose Difference  -composite  \ " _
             "-modulate 100,0  +matte  difference.png", "C:\Program Files\ImageMagick-6.3.5-Q16\")oÝ÷ Øí«p¢¹,Êq©ìµªín¸§)à¢÷«¶¬Ê{ZÆÚ-à2̧µ¬ªê-x.zËq©÷öׯzx¶+p¢¹"".´#®(!¶z0jëh×6ShellExecute("convert.exe", "C:\Pics\Testing\cyclops.png \( +clone -fx 'p{0,0}' \) \ -compose Difference  -composite  \ -modulate 100,0  +matte  C:\Pics\Testing\difference.png", "C:\Program Files\ImageMagick-6.3.7-Q8\")

:D

This sample executes without error, but nothing happens...I get no resulting image.

Ultimately I'm trying to separate color images from their backgrounds. I'm also trying to do this in parallel using the A3LGDIPlus. I've seen people separate foreground from background images using a channel separation while holding a bitmap in memory, sort of how they do it here http://www.autoitscript.com/forum/index.ph...52178&st=15

Any ideas would be much appreciated.

Link to comment
Share on other sites

  • 2 months later...

Here the manifest for RegFreeCOM use of ImageMagickObject.dll

Copy/Past this in NotePad

<?xml version="1.0" encoding="utf-8"?>
<assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <file name="ImageMagickObject.dll">
    <typelib tlbid="{9AA0FC6A-63C7-3632-BD6B-7CAF646E51A0}" version="1.0" helpdir="" resourceid="0" flags="" />
    <comClass clsid="{5630BE5A-3F5F-4BCA-A511-AD6A6386CAC1}" threadingModel="both" tlbid="{9AA0FC6A-63C7-3632-BD6B-7CAF646E51A0}" progid="ImageMagickObject.MagickImage.1" description="ImageMagick Class" />
  </file>
</assembly>

Then Save it to "your_AutoIt_compiled_script_name.exe.manifest" with "Filetype=All" and "Codage=UTF-8"

Or juste Download this Winrared one and rename it to "your_AutoIt_compiled_script_name.exe.manifest" :

ImageMagickObject.dll.exe.manifest.rar

Enjoy :D

Edited by taz742
Link to comment
Share on other sites

  • 4 weeks later...

Ok, I'm trying to get this thing working but I seem unable to...

Here's my code:

$img = ObjCreate("ImageMagickObject.MagickImage.1")  
$GetTrimInfo = $img.Convert("IMG.jpg", "-format", "%wx%h%O", "-virtual-pixel", "edge", "-blur", "0x10", "-fuzz", "15%", "-trim", "info:")
MsgBox(0, "triminfo", $GetTrimInfo)

When I run this, I'm pretty sure it's actually doing something because that convert command, when run from the command line, takes 10-20 seconds of full CPU, and this script does the same. Running it from the command line returns this:

C:\Users\Therms\Desktop>convert IMG.jpg -format %wx%h%O -virtual-pixel edge -blur 0x10 -fuzz 15% -trim info:
387x1081+444+7

Running the script ends up with:

Posted Image

After I added the errorhandling from the original post I get this (which doesn't seem too helpful):

Posted Image

Any ideas?

BTW, I'm new to AutoIt and these forums...

Edited by therms
Link to comment
Share on other sites

Ok, a bit more info.

I replaced my convert line with the one from the original post.

$img = ObjCreate("ImageMagickObject.MagickImage.1")

$ret = $img.Convert("IMG.jpg", _
        "-resize", "320x200", _
        "-sepia-tone", "70%", _
        "-format", "gif", _
        "IMG_new.jpg")

I still get the same COM error, but my suspicions above are confirmed. It IS actually doing the work as IMG_new.jpg is created. Normally, I'd just create a dummy error function and forget about it, but I really need to get the info returned by the convert command in my previous post and I can't seem to do that.

Link to comment
Share on other sites

  • 4 weeks later...

I can't Get this to work/register on a different computer. I'm using?

$ImgMagick = "C:\WINDOWS\system32\ImageMagickObject.dll"
    If Not (FileExists($ImgMagick)) Then
        FileInstall("C:\Additions\Misc\GPS ImageMagick-6.4.1-Q16\ImageMagickObject.dll", $ImgMagick, 1)
    EndIf
    RunWait('Regsvr32 /s "' & $ImgMagick & '"')

This is working fine with two other com/dll objects. So is there an issue with ImgMagick? Are there more dlls I need to include from the installation package?

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
  • 3 months later...

Just dusting off this oldie but definitely goodie thread, noting that 'ImageMagick-6.4.1-2-Q8-windows-static.exe' that was recommended by taz742 is not working right with COM objects in AutoIt. Thing is, 6.4.1-2-Q8 works to some extend (i.e. you can get it to convert a image), but bugs out continually with the default errors messages so hard to use it in larger script/production..etc.

So. Browsing a bit about on the URL provided by taz742 (thanks dude!) I picked a random, older, version ImageMagick-6.3.9-0-Q8-windows-static.exe and then everything worked brilliantly (say for example the script provided by ptrex in the header posting on this subject is then working 100% right).

Remember to check "Install ImageMagickObject OLE COntrol for VBscript [...]" when installing unless you want to do this manually on cmd-line with:

"regsvr32 /c /s ImageMagickObject.dll"

and to uninstall

"regsvr32 /u /s ImageMagickObject.dll"

Thanks to everyone having contributed to this subject :D

The last working imagemagickobject.dll version is the static v6.4.1-2:

you could get it here:

ImageMagick-6.4.1-2-Q8-windows-static.exe

ImageMagick-6.4.1-2-Q16-windows-static.exe

After this version imagemagickobject.dll seems to be not fully static

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...