Convert CLI arguments to IMObject

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
marshdamp68
Posts: 2
Joined: 2011-02-21T09:51:33-07:00
Authentication code: 8675308

Convert CLI arguments to IMObject

Post by marshdamp68 »

I have a simple VB program that I can make work for simple image conversions and -draw line commands. I really need to use a more complicated list of arguments but I can not get it to work. I'm not sure how to parse it out correctly to make it work with IMobject. This is the command line I need to make work using IMObject:

Code: Select all

convert test.tif -gravity center -draw "translate 500,209 rotate -35.058 scale 4.215,4.215 image over -500,-209,0,0 'label2.gif'" output.tif
I think the quotes in the -draw section are causing me the problem. I have tried:

Code: Select all

"test.tif", "-gravity", "center", "-draw", """translate", "500,209", "rotate", "-35.058", "scale" ,"4.215,4.215, "image", "over", "-500,-209,0,0", "'label2.gif'""","output.tif"
but it doesn't work.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Convert CLI arguments to IMObject

Post by el_supremo »

I haven't used VB but I think the argument to -draw should be one long string in VB. Try it like this:

Code: Select all

"test.tif", "-gravity", "center", "-draw", "translate 500,209 rotate -35.058 scale 4.215,4.215, image over -500,-209,0,0 label2.gif","output.tif"
In this particular case the single quotes around label2.gif aren't needed. They are required when the filename has a space in it.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
marshdamp68
Posts: 2
Joined: 2011-02-21T09:51:33-07:00
Authentication code: 8675308

Re: Convert CLI arguments to IMObject

Post by marshdamp68 »

Thanks! That was a combination I hadn't tried yet. Unfortunately it did not work either.

Here's my whole program...most of which I found in the archives...

Code: Select all

    Sub Main()
        Dim objImage As New ImageMagickObject.MagickImage()
        Dim fnm(1) As Object
        Dim retval As Object
        Dim original As String = "C:\AgileDir\work\Cancel\test.tif"
        Dim final As String = "C:\AgileDir\work\Cancel\output.tif"
        Dim label As String = "C:\AgileDir\work\Cancel\label2.gif"

        ReDim fnm(5)
        fnm(0) = original
        fnm(1) = "-gravity"
        fnm(2) = "center"
        fnm(3) = "-draw"

        fnm(4) = "line 0,0,2000,2000"
        'fnm(4) = "image over " + label
        'fnm(4) = "translate 500,209 rotate -35.058 scale 4.215,4.215 image over " + label

        fnm(5) = final
        retval = objImage.Convert(fnm)
End Sub
I show 3 different variations of the line that start fnm(4). The first one, which draws a line, works great. If I try the 2nd one which should simply place an image on top of my original image doesn't work. I'm wondering if the image part of draw is not implimented in the IMObject or if there is a special way to input the name of my label image.
User avatar
MvGulik
Posts: 4
Joined: 2011-03-16T09:50:14-07:00
Authentication code: 8675308

Re: Convert CLI arguments to IMObject

Post by MvGulik »

Hi.

I think I have a very similar, or same, problem. But in my case with the -fx parameter part.
Even tried using a expression file (@) as input for the -fx command, but the -fx expression always seems to evaluates to a zero result.
(while the same commands used directly with convert.exe do the job as expected)

Hoping any solution for the OP also will work for me.
(6.6.8-4-Q16-windows-dll, XpPro32, AutoIt)
Last edited by MvGulik on 2011-08-29T01:03:14-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert CLI arguments to IMObject

Post by anthony »

Perhaps an example of the code you are typing.

My understanding is the vb code is broken up in exactly the same way that the command line is.
As such "-fx" takes just one argument after it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
MvGulik
Posts: 4
Joined: 2011-03-16T09:50:14-07:00
Authentication code: 8675308

Re: Convert CLI arguments to IMObject

Post by MvGulik »

Hi.
A one year anniversary topics checkup? :wink:

I don't mind trying to dig up some code, if I can find the project again. Although giving it a second though ... I'm kinda wondering what I was actually doing back than. :? (probably just need some time to remember it ...)

(Also kinda switch to using nip2(frontend for VIPS) as general image processing tool over ImageMagick.)

Cheers
MvGulik
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert CLI arguments to IMObject

Post by anthony »

Sorry, I saw 'March 17' and thought it wasn't too old.

I was lurking in this sub-forum for the first time, having had some recent exposure to the internal code used for VB processing, even though I myself have never used VB, let alone programmed under windows.

As a moderator I could delete the last few posts, and return this topic to 1-year old obscurity status :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
MvGulik
Posts: 4
Joined: 2011-03-16T09:50:14-07:00
Authentication code: 8675308

Re: Convert CLI arguments to IMObject

Post by MvGulik »

If you like. I don't mind. (If the problem crops up again I can ask again. Probably in new topic.)

(late replay: overlooked notification mail.)
Post Reply