ImageEn, unit iexProcEffects |
|
TIEImageEffectsList.LoadFromFile
Declaration
procedure LoadFromFile(const FileName: String; Append: Boolean = False);
Description
Load a list of
Image Processing effects (i.e. used to perform a set of operations upon an image).
Note:
◼LoadFromFile only works with files saved using
SaveToFile
◼You do NOT need to call ImageEnView1.Update() after calling Delete(). It will update automatically
// Apply effects in a chain file to current image
if OpenDialog1.Execute() then
begin
ImageEnView1.IEBitmap.EffectsChain.Enabled := True;
ImageEnView1.IEBitmap.EffectsChain.LoadFromFile( OpenDialog1.FileName );
ImageEnView1.IEBitmap.EffectsChain.Apply();
end;
// Load effects chain from file and apply the effects to a list of images
bmp := TIEBitmap.Create();
for i := 0 to ssFiles.Count - 1 do
begin
bmp.LoadFromFile( ssFiles[i] );
bmp.EffectsChain.Enabled := True;
bmp.EffectsChain.LoadFromFile( 'D:\Effects.ieeff' );
bmp.EffectsChain.Apply();
bmp.SaveToFile( ChangeFileExt( ssFiles[i], '_convert.jpg' );
end;
bmp.Free();
// Save an effects chain to file
var
opList: TIEImageEffectsList;
op: TIEImageEffect;
begin
opList := TIEImageEffectsList.Create();
op := TIEImageEffect.Create();
try
// Reduce size by half
op.Operation := peResize;
op.Resize_Width := 50;
op.Resize_Height := 50;
op.Resize_ByPercent := True;
op.Resize_QualityFilter := rfLanczos3;
opList.Add( op );
// Enhance contrast
op.Operation := peContrast;
op.Contrast_Contrast := 20;
opList.Add( op );
// Rotate 45 deg. clockwise
op.Operation := peRotate;
op.Rotate_Angle := -45;
op.Rotate_BackgroundColor := clBlack;
op.Rotate_Antialias := ierFast;
opList.Add( op );
opList.SaveToFile( 'D:\Effects.chain' );
finally
opList.Free;
op.Free;
end;
end;
// Apply effects in a chain file to current image
ImageEnView1.IEBitmap.EffectsChain.Enabled := True;
ImageEnView1.IEBitmap.EffectsChain.LoadFromFile( 'D:\Effects.chain' );
ImageEnView1.IEBitmap.EffectsChain.Apply();
See Also
◼SaveToFile
◼LoadFromFile
◼LoadFromStream