I am trying to use the ImageMagickObject COM component that comes with the Windows installer for ImageMagick, imported into my C # project as a COM reference. Until now, I could use it to convert images from one file to disk to another file on disk. I am trying to get it to convert a file to memory and return it to an array of bytes, as shown in the file ArrayTest.vbs included in the library. Has anyone successfully done this before? The documentation is very missing in this function ...
My code is:
MagickImageClass _magic = new MagickImageClass();
object[] myarray = new object[1];
myarray[0] = "JPEG:";
object[] args = new object[] { tbFilename.Text, "-colorspace", "cmyk", "-resize", "50%", myarray };
var result = _magic.Convert(ref args);
Their sample from the ArrayTest.vbs array:
Dim img
Dim myarray(1)
Set img = CreateObject("ImageMagickObject.MagickImage.1")
myarray(0)="8BIM:"
msgs = img.Convert("null:","-profile","8BIMTEXT:iptctext.txt",myarray)
ImageMagick, "null:" - , . "-profile" "8BIM: iptctext.txt" - , Convert, - . myarray . myarray . !!