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 Format. If it is not specified ImageEn will determine the file type automatically.
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