ImageEn, unit iexBitmaps

TIOParams.LoadToWidth

TIOParams.LoadToWidth


Declaration

property LoadToWidth: integer;


Description

Specifies the minimum width for the image when loading.
Set LoadToWidth and LoadToHeight to the display size for this image and it will be loaded more quickly when:
Loading JPEG and JPEG_Scale=ioJPEG_AUTOCALC
Loading JPEG2000 and J2000_Reduce=-1
Loading PDF files if AutoScaleImport=True
Importing Meta files if AutoScaleImport=True
Loading ImageMagick files if AutoScaleImport=True

Note:
Set LoadToWidth and LoadToHeight to 0 to reset optimized loading
ImageEn will consider the aspect ratio to ensure both LoadToWidth and LoadToHeight exceed the minimum specified values (so the final size will generally be larger than the specified values)

Default: 0


Examples

// Load a JPEG as fast as possible, ensuring width is >= 150 and height >= 100 (while maintaining the aspect ratio)
ImageEnView1.IO.Params.LoadToWidth  := 150;
ImageEnView1.IO.Params.LoadToHeight := 100;
ImageEnView1.IO.Params.JPEG_Scale := ioJPEG_AUTOCALC;
ImageEnView1.IO.LoadFromFile('C:\myimage.jpg');

// Load a JPEG2000 image as fast as possible, ensuring width is >= 150 and height >= 100 (while maintaining the aspect ratio)
ImageEnView1.IO.Params.LoadToWidth  := 150;
ImageEnView1.IO.Params.LoadToHeight := 100;
ImageEnView1.IO.Params.J2000_Reduce := -1; // auto-calc
ImageEnView1.LoadFromFile('image.jp2');

// Load an SVG at size 2000x1000px
ImageEnView1.IO.Params.AutoScaleImport := True;
ImageEnView1.IO.Params.LoadToWidth     := 2000;
ImageEnView1.IO.Params.LoadToHeight    := 1000;
ImageEnView1.IO.LoadFromFile( 'D:\SVG\Lion.svg' );

// 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.ParamsEnabled := True;
    bmp.Params.LoadToWidth  := 1000;
    bmp.Params.LoadToHeight := 1000;
    bmp.Params.AutoScaleImport := True;
    bmp.LoadFromFile('D:\Input.svg');
    bmp.Params.JPEG_Quality := 90;
    bmp.SaveToFile('D:\Output.jpg');
  finally
    bmp.Free;
  end;
end;


See Also

LoadToHeight
OptimizeLoadingParams