ImageEn, unit imageenio

TImageEnIO.SaveToStreamJpeg

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('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('image.jpg');
  ImageEnView1.IO.StreamHeaders := False;
  ImageEnView1.IO.SaveToFileJPEG(fs);
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 );