Loading...

Export Image from GdPicture to a TImage Delphi object

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Export Image from GdPicture to a TImage Delphi object

Postby Slava » Wed Jun 27, 2007 11:12 am

Hello,

I am trying to create thumbnails from all the files in a folder with Delphi 7. I achieved this by creating GdViewer for each thumbnail but its slow and unnessesary.

i would like to know if it is possible to get a bitmap (in runtime) out of GdViewer/GdPicture when an image is loaded, to put in standard image components like TImage.

I mean something like
TImage.Bitmap := GdViewer.GetBitmap
would be great but there's no bitmap, GetNativeImage returns an Integer, gdpicture.GetPicture returns IPictureDisp ?, even gdpicture.GetHBitmap returns an integer.

if this cannot be done, is there other way to create thumbnails? (I have seen a VB example, cannot understand why ImageList1.ListImages.Add(... , oGdPicture.GetPicture, ...) works, because it doesnt in Delphi, saying "Incompatible Types: TBitmap and IPictureDisp".

Anyone?

Slava
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Wed Jun 27, 2007 11:43 am

Hi,

You can do like that:

Code: Select all
Image1.Picture.Bitmap.Handle:=oGdPicture.GetHBitmap;



Best regards,

Loïc Carrère
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby Slava » Wed Jun 27, 2007 12:42 pm

Loïc wrote:You can do like that:

Code: Select all
Image1.Picture.Bitmap.Handle:=oGdPicture.GetHBitmap;



Really simple, and works. Thanks. Quick respond, thanks again.

One more question, this dont seem to work:
Code: Select all
imgThumb.Picture.Bitmap.Handle := oGdPicture.MakeThumbnail( ... );

Should it work? or do i have to use oGdPicture.Resize and oGdPicture.GetHBitmap?

Slava
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Wed Jun 27, 2007 1:56 pm

Hi,

MakeThumbnail returns a gdiplus image handle, not a HBtimap.

You can do something like that:

Code: Select all
nNativeImage:= oGdPicture.GetnativeImage;
oGdPicture.SetNativeImage( oGdPicture.MakeThumbnail( 200,200));
Image1.Picture.Bitmap.Handle:=oGdPicture.GetHBitmap;
oGdPicture.SetNativeImage(nNativeImage);


Best regards,

Loïc Carrère
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 2 guests

cron