ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TPicture to TImageEnView
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

AndyColmes

USA
351 Posts

Posted - May 08 2014 :  08:07:23  Show Profile  Reply
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;

AndyColmes

USA
351 Posts

Posted - May 08 2014 :  13:24:51  Show Profile  Reply
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;
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: