ImageEn, unit iexDBBitmaps

TIEDBBitmap.Read

TIEDBBitmap.Read

Declaration

function Read(): Boolean; overload;
function Read(aBlobField: TBlobField; FileType: TIOFileType = ioUnknown; IOParams: TIOParams = nil): Boolean; overload;
function Read(const FileName: string; IOParams: TIOParams = nil): Boolean; overload;
function Read(Stream: TStream; FileType: TIOFileType = ioUnknown; IOParams: TIOParams = nil): Boolean; overload;
function Read(Buffer: Pointer; BufferSize: Integer; FileType: TIOFileType = ioUnknown; IOParams: TIOParams = nil): Boolean;

Description

Load an image from a blob field, file or stream (of any format supported by the TImageEnIO class).
The Read(); overload reads the image at the current database position using the properties of DataSource, ImageBlobField and/or FilenameField.
When reading from a blob or stream you can optionally specify the file format of the image. If ioUnknown is specified, the format is detected automatically by reading the image header.
You can optionally pass an TIOParams object for the I/O parameters of the file (see also ParamsEnabled).
Returns False on failure.

Examples

// Extract an image from a database and save it
MyBMP := TIEDBBitmap.Create();
MyBMP.Read( MyTableImageBlob );
MyBmp.Write( 'D:\MyBlobImage.jpeg' );
MyBmp.Free();

// Reduce the size of an image in the database
MyBMP := TIEDBBitmap.Create();
MyBMP.Read( MyTableImageBlobField );
MyBmp.Resample( 800, 600, rfLanczos3, True);
MyBmp.JpegQuality := 75;
MyBmp.Write( MyTableImageBlobField, ioJPEG );
MyBmp.Free();

See Also

LoadImage
Write
WicFastLoading