ImageEn, unit imageenproc




function ApplyPreviews(Dest: TObject = nil; SourceParams: TIEImageEffect = nil): string; overload;
function ApplyPreviews(Dest: TObject; SourceParamsList: TIEImageEffectsList): string; overload;


Apply image effects specified in the Image Processing dialog (using DoPreviews) to another image.
Dest can be a TIEBitmap or a TImageEnView. If it is nil, the effects are applied to the current image.
You can optionally apply effects specified by a custom TIEImageEffect object specified by SourceParams (such as another TImageEnProc.IPDialogParams), or multiple effects specified by SourceParamsList
Result is a string description of the operation, e.g. "Resize 50%" or '' if no operation occured.

- ApplyPreviews() only applies the values specified on the active page of the Image Processing dialog, so you are best to specify a single Preview Effect for DoPreviews() or add prppSingleEffectOnly to PreviewsParams
- Only properties supported by IPDialogParams will be applied

Example 1

// Prompt user to specify color curve settings (using our "Editing" TImageEnView)
btnApplyCurve.Enabled := ImageEnView1.Proc.DoPreviews( [peColorCurve] );

// Apply specified color curve to current image (in our "Viewing" TImageEnView)
procedure TForm1.btnApplyCurveClick(Sender: TObject);
  ImageEnView1.Proc.ApplyPreviews( ImageEnView2 );

Example 2

// Allow user to specify a resampling value and apply it to all images in a folder
ssFiles := TStringList.Create;
GetFilesInFolder( ssFiles, 'D:\test\' ); // This is an example method only. It does not exist
if ImageEnView1.Proc.DoPreviews( [peResize] ) then
  for i := 0 to ssFiles.Count - 1 do
    bmp := TIEBitmap.Create;
    bmp.Read( ssFiles[i] );
    ImageEnView1.Proc.ApplyPreviews( bmp );
    bmp.Write( ssFiles[i] );

Example 3

// Allow the user to specify any effect from the Previews dialog
ImageEnView1.Proc.PreviewsParams := ImageEnView1.Proc.PreviewsParams + [ prppSingleEffectOnly ];
ImageEnView1.Proc.IPDialogParams.SaveToFile( ChangeFileExt( Application.ExeName, '.effect' ));

// Apply same effect to the current image
ImageEnView1.Proc.IPDialogParams.LoadFromFile( ChangeFileExt( Application.ExeName, '.effect' ));

See Also

Published Property  DoPreviews
Public Property  IPDialogParams