Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
AndyColmes
Posted - May 08 2014 : 08:07:23 I have an ActiveX COM that outputs a picture object. The following code allows me to show it in a TImage. But I am unable to transfer whatever that was in the TImage to a TImageEnView. I tried saving the TImage to file (Image1.Picture.SaveToFile()) but still got an error. How do I either save the file or transfer it to a TImageEnView so I can further process the image? I am expecting an 8-bit grayscale image from this ActiveX.
I appreciate any help and I thank you in advance.
Andy
var
iPic: IPictureDisp;
iPic := Rasterizer_1.getDeviceNPicture( k ) as IPictureDisp;
APic := TPicture.Create;
try
SetOlePicture(APic, iPic);
Image1.Picture := nil;
Image1.Picture.Assign( APic);
Image1.Update;
finally
FreeAndNil( APic );
end;
1 L A T E S T R E P L I E S (Newest First)
AndyColmes
Posted - May 08 2014 : 13:24:51 I found this to work in case anyone needs it.
OG := TOleGraphic.Create;
try
OG.Picture := iPic As IPicture;
{ convert to a TBitmap, so it can be saved in BMP format }
bmp := TBitmap.Create;
try
bmp.PixelFormat := pf24Bit;
bmp.Width := OG.Width;
bmp.Height := OG.Height;
bmp.Canvas.Draw(0, 0, OG);
fs1 := 'Channel-' + chName + '.bmp';
bmp.SaveToFile(fs1);
finally
FreeAndNil(bmp);
end;
finally
FreeAndNil(OG);
end;
end;