annotate not working w/ COM Object IM from VB
Posted: 2013-09-03T04:52:47-07:00
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
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