ImageEn, unit imageenio

TImageEnIO.LoadFromStreamJpeg

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 );