TImageEnIO.LoadFromStreamJpeg
Declaration
function LoadFromStreamJpeg(Stream: TStream): Boolean;
Description
Loads an image from a stream containing a JPEG file. The result will be False if an error is encountered, e.g. the file in the stream is not JPEG format (
Aborting will be True).
Note:
◼If
StreamHeaders property is True, the stream must have a special header (saved with
SaveToStreamJPEG)
◼LoadFromStreamJpeg does not reset the position of the stream, so you may need to first call Stream.Position := 0;
Examples
// Load a JPEG file with LoadFromStreamJPEG
var
fs: TFileStream;
begin
fs := TFileStream.Create( 'C:\myfile.jpg', fmOpenRead );
ImageEnView1.IO.LoadFromStreamJpeg( fs );
fs.Free();
end;
// Show a preview and compressed size for a JPEG
ienSource.IO.Params.JPEG_Quality := JPEGQuality;
ienSource.IO.Params.JPEG_ColorSpace := JPEGPhotometric;
ienSource.IO.Params.JPEG_DCTMethod := JPEGDCTMethod;
ienSource.IO.Params.JPEG_OptimalHuffman := JPEGOptimalHuffman;
ienSource.IO.Params.JPEG_Smooth := JPEGSmooth;
ienSource.IO.Params.JPEG_Progressive := JPEGProgressive;
ienSource.IO.SaveToStreamJpeg(mf);
mf.Position := 0;
ienPreview.IO.LoadFromStreamJpeg(mf);
lblSaveSize.Caption := IEBytesToStr2( mf.Size );