ImageEn, unit iexBitmaps

TIEBitmap.Params

TIEBitmap.Params


Declaration

property Params: TIOParams;


Description

If ParamsEnabled is true, then Params provides access to the TIOParams object for the image.
The parameters are updated when loading from files or streams. You can modify these parameters before saving the image.
If ParamsEnabled is false, result will be nil.

Note:
 Accessing Params will set ParamsEnabled to true
 ParamsEnabled should only be used when TIEBitmap is being used as a stand-alone object. When it is attached to a TImageEnView or TImageEnMIO, use TImageEnIO.Params instead.


Examples

// Reduce the size of a JPEG image
aBmp := TIEBitmap.create;
aBmp.ParamsEnabled := True;     // Load params with the image
aBmp.Read( 'C:\MyImage.jpeg' );
aBmp.Params.JPEG_Quality := 70;
aBmp.Write( 'C:\OutImage.jpeg' );
aBmp.Free;

// Which is the same as:
aBmp := TIEBitmap.create;
aIOParams := TIOParams.create;
aBmp.Read( 'C:\MyImage.jpeg', aIOParams );
aIOParams.JPEG_Quality := 70;
aBmp.Write( 'C:\OutImage.jpeg', aIOParams );
aIOParams.free;
aBmp.Free;


// Load the third image in a TIFF and save it to JPEG
aBmp := TIEBitmap.create;
aBmp.ParamsEnabled := True; // Load params with the image
aBmp.Params.ImageIndex := 2;
aBmp.Read( 'C:\MyTiffDoc.TIFF' );
aBmp.Params.JPEG_Quality := 70;
aBmp.Write( 'D:\Page3.jpeg' );
aBmp.Free;


// Convert an SVG file to JPEG at max size of 1000x1000 (will be adjusted to maintain aspect ratio)
var
  bmp: TIEBitmap;
begin
  bmp := TIEBitmap.Create;
  try
    bmp.Params.LoadToWidth  := 1000;
    bmp.Params.LoadToHeight := 1000;
    bmp.Params.AutoScaleImport := True;
    bmp.Read('D:\Input.svg');
    bmp.Params.JPEG_Quality := 90;
    bmp.Write('D:\Output.jpg');
  finally
    bmp.Free;
  end;
end;