TImageEnIO.SaveToStreamJpeg
Declaration
procedure SaveToStreamJpeg(Stream: TStream);
Description
Saves the current image to a stream in JPEG format.
Note:
◼If
StreamHeaders property is True, it adds an additional special header as needed for multi-image streams.
◼To abort while saving set
Aborting to True
Examples
// Save ImageEnView1 and ImageEnView2 attached images in file images.dat
// images.dat isn't loadable with LoadFromFileXXX methods
var
fs: TFileStream;
begin
fs := TFileStream.Create( 'D:\bmpimages.dat', fmCreate );
ImageEnView1.IO.StreamHeaders := True;
ImageEnView1.IO.SaveToStreamJPEG( fs );
ImageEnView2.IO.StreamHeaders := True;
ImageEnView2.IO.SaveToStreamJPEG( fs );
fs.Free();
end;
// Save a single image to image.jpg
// image.jpg is loadable with LoadFromFileXXX methods
var
fs: TFileStream;
begin
fs := TFileStream.Create( 'D:\image.jpg' );
ImageEnView1.IO.StreamHeaders := False;
ImageEnView1.IO.SaveToStreamJPEG( 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 );