Problem with streams and images
From: Lauchlan M (LMackinnon_at_NOSPAMHotmail.com)
Date: 10/31/03
- Next message: Kerry Frater: "Re: ListBox & Objects"
- Previous message: Anchorman: "Re: ShellExecute not working properly"
- Next in thread: Anders Isaksson: "Re: Problem with streams and images"
- Reply: Anders Isaksson: "Re: Problem with streams and images"
- Reply: Kurt Barthelmess: "Re: Problem with streams and images"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 23:40:06 +1000
Hi
I want to save a TImage image to a database BLOB. But I'm having trouble
with the streaming part.
The following code (cutting out the database stuff) should take the image
from the TImage, store it in a stream, and reload it into the TImage.
But it AVs on the line (*), below.
// start with an image already loaded in the imgECG TImage component
// stream the graphic
ECGImageStream := TMemoryStream.Create;
TJPEGImage(imgECG.Picture.Graphic).SaveToStream(ECGImageStream);
imgECG.Picture.Assign(nil); // clear the old image
MessageDlg(IntToStr(ECGImageBlobStream.Size), mtInformation, [mbOk], 0);
// check the stream is non-zero - it is!
// read the graphic back into the TImage
TJPEGImage(imgECG.Picture.Graphic).LoadFromStream(ECGImageStream); //
<-- (*) AVs here!
ECGImageStream.Free;
Also, it's a bit limited since it assumes .jpg images in the typecasting.
Any suggestions?
Thanks!
Lauchlan M
- Next message: Kerry Frater: "Re: ListBox & Objects"
- Previous message: Anchorman: "Re: ShellExecute not working properly"
- Next in thread: Anders Isaksson: "Re: Problem with streams and images"
- Reply: Anders Isaksson: "Re: Problem with streams and images"
- Reply: Kurt Barthelmess: "Re: Problem with streams and images"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]