Hi guys:
In the COM Object version if IM, the Convert() function takes ALL the parameters as strings (in quotes, unless your calling a variable you dimensioned as a string), separated by commas. like this:
this works:
destFilePath = Me.ProjRootFolder & "\test.png"
txtConvertResult = objMagImage.convert("png:", "-size", "700x500", "xc:none", "-stroke", "black", "-strokewidth", "1", "-fill", "#555555", "-draw", "roundRectangle 1,1 348,158 10,10 " destFilePath)
notice that "roundRectangle" which requires quotes in other builds, does NOT need quotes in COM, it already is a string.
this does NOT work:
TLUnitTxt = "Now is the time for all good men"
txtConvertResult = objMagImage.convert("png:", "-size", "700x500", "xc:gray", "-fill", "black", "-font", "Arial", "-pointsize", "20", "-annotate", "+10,+10", TLUnitTxt, destFilePath)
IM doesn't error, it makes a picture, but there are no words on it.
now in examples I've seen -annotote uses single quotes around the text. DOS command line examples I've seen use double quotes. I'm assuming that is problem.
I've tried EVERY COMBINATION of single quotes, double quotes, double double quotes, triple double quotes, even "& Chr(34) &" (which is an old VB trick for quote marks within a string)
I'm stumped. Has any anyone ever gotten -annotate to work from a COM object?
do i need a -draw in there somewhere?
AHA TIA
Ben
annotate not working w/ COM Object IM from VB
-
- Posts: 21
- Joined: 2013-09-01T05:52:51-07:00
- Authentication code: 6789
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: annotate not working w/ COM Object IM from VB
I don't use COM, so can't advise about that.
"-annotate" (like most options) doesn't need the string to be in quotes unless the string contains spaces. For your initial tests, you might remove the spaces.
This command works from the command prompt...
... making black text crammed into top-left on a gray background.
Maybe COM has a problem with "-font Arial". Try removing it, or providing the full filename to the ttf font file.
"-annotate" (like most options) doesn't need the string to be in quotes unless the string contains spaces. For your initial tests, you might remove the spaces.
This command works from the command prompt...
Code: Select all
convert -size 700x500 xc:Gray -fill Black -font Arial -pointsize 20 -annotate +10+10 Nosisthetimeforallgoodmen t.png
Maybe COM has a problem with "-font Arial". Try removing it, or providing the full filename to the ttf font file.
snibgo's IM pages: im.snibgo.com
-
- Posts: 21
- Joined: 2013-09-01T05:52:51-07:00
- Authentication code: 6789
Re: annotate not working w/ COM Object IM from VB
thanks but I had tries both those things, (and just did again). no go.
guess i need some one who has used the COM DLL
Thanks anyway
guess i need some one who has used the COM DLL
Thanks anyway
Re: annotate not working w/ COM Object IM from VB
Last edited by dlemstra on 2013-09-03T06:28:05-07:00, edited 1 time in total.
-
- Posts: 21
- Joined: 2013-09-01T05:52:51-07:00
- Authentication code: 6789
Re: annotate not working w/ COM Object IM from VB
1. that link is dead. (although I did find your page from your sig)
2. not .Net
it's just going to be a syntax issue.
(Am I the only guy out there using the COM object?)
2. not .Net
it's just going to be a syntax issue.
(Am I the only guy out there using the COM object?)
Re: annotate not working w/ COM Object IM from VB
Did you try: "+10,+10 " & TLUnitTxt?
-
- Posts: 21
- Joined: 2013-09-01T05:52:51-07:00
- Authentication code: 6789
Re: annotate not working w/ COM Object IM from VB
Well, i did just now, that cause IM to error out and not generate a file. Just like it does if you leave the quotes out or combine any other 2 or more parameters into one string.
(at least I starting to learn its behavior that well.)
(at least I starting to learn its behavior that well.)
-
- Posts: 21
- Joined: 2013-09-01T05:52:51-07:00
- Authentication code: 6789
Re: annotate not working w/ COM Object IM from VB
Nevermind.... (does anyone remember Emily Litella?)
I reinstalled IM and it works, something wrong with my install, (or my build of the Object)
thanks guys
I reinstalled IM and it works, something wrong with my install, (or my build of the Object)
thanks guys
Re: annotate not working w/ COM Object IM from VB
Would you mind posting the parameters that worked? So other users of the COM Object will know how it should work.