Load and save image from blob field in delphi using firebird

In my Firebird database I have a Blob field that contain a Bitmap. I’ll have to load and display in a TImage located on my Form. Subsequently I’ll have to save in the same field the image selected by a OpenDialog.

Delphi: How to use TJvRichEdit to load or save text and images (not just .bmp) to file or firebird blob field?

Regarding TJvRichEdit and Delphi… How? Load/Save rtf (including text and images – not only .bmp) to/from a file? Read/Write rtf (including text and images – not only .bmp) to/from Firebird blob fie

Delphi load image save as blob in a sql database

I’m trying to load a Image control from a image blob saved previously in a sql database.I have testd so many ways and i can’t make it work. The image blob is saved as: qry.SQL.Text := ‘update tbl set

How to restore an unknown type BLOB field from Firebird

I am trying to restore a BLOB field stored in a Firebird database, and the only information I have is that the content of the BLOB field is a document. I’ve tried using IBManager to right-click on the



Blob Image on Firebird

How to insert blog image to firebird ? I have successfully insert it using ibexpert but when i access it from my web app, it can’t show. HOw to solve this ?

IBO and Firebird Save To Blob Field By Params [closed]

I want to save a picture from TImage to blob field by params. I’ve search around the net but I can’t get it. I try: params[1].LoadFromFile(PicPath). It works but I just want to stream from TImage. Sho

Store image as blob in firebird

I want to store image data inside database as blob. Database is firebird. On adding new field of type blob I have SegmentSize = 16384 and SubType. I was thinking to leave SegmentSize as is and to use

Size of a blob field in Firebird

Is there a way to retrieve (using a select statement) the size of a blob field in Firebird?? I’ve a field called data and I’d like to know the total size of all the records in the table. Thanks.

How to save jpg image to database and then load it in Delphi using FIBplus and TImage?

How to save jpg image to database and then load it in Delphi using FIBplus and TImage?

how to save image in blob field using watir?

<table> <tr> <td>hello</td> <td><img src=xyz.png width=100 height=100></td> </tr> </table> i want to save this xyz.png in blob form into my

Delphi TPngImageList save/load from file

I’d like to load and save TPngImageList (Delphi7 version, PngComponents) from/to file (better single PNG file for all 20 png icons in image list). I can’t find LoadFromFile/SaveToFile methods. How to

Answers

Procedure LoadBitmapFromBlob(Bitmap: TBitmap; Blob: TBlobField);
var
  ms, ms2: TMemoryStream;
begin
  ms := TMemoryStream.Create;
  try
    Blob.SaveToStream(ms);
    ms.Position := 0;
    Bitmap.LoadFromStream(ms);
  finally
    ms.Free;
  end;
end;

example usage

procedure TForm4.Button1Click(Sender: TObject);
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create;
  try
    LoadBitmapFromBlob(bmp, TBlobField(Dataset.FieldByName('Image')));
    Image1.Picture.Assign(bmp);
    bmp.SaveToFile(OpenDialog.FileName);
  finally
    bmp.Free;
  end;

end;