Export Image from GdPicture to a TImage Delphi object
Export Image from GdPicture to a TImage Delphi object
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
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
Hi,
You can do like that:
Best regards,
Loïc Carrère
You can do like that:
Code: Select all
Image1.Picture.Bitmap.Handle:=oGdPicture.GetHBitmap;
Best regards,
Loïc Carrère
Really simple, and works. Thanks. Quick respond, thanks again.Loïc wrote: You can do like that:
Code: Select all
Image1.Picture.Bitmap.Handle:=oGdPicture.GetHBitmap;
One more question, this dont seem to work:
Code: Select all
imgThumb.Picture.Bitmap.Handle := oGdPicture.MakeThumbnail( ... );
Slava
Hi,
MakeThumbnail returns a gdiplus image handle, not a HBtimap.
You can do something like that:
Best regards,
Loïc Carrère
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);
Loïc Carrère
Who is online
Users browsing this forum: No registered users and 2 guests