Stores all the parameters of a particular image effect or editing operation, e.g. rotating 90 deg. or increasing contast by 20%
This class provides read/write access to the parameters of the Image Processing Dialog (displayed by calling DoPreviews).
It can also be used to build a chain of a effects to apply to an image.
Auto-Enhance - WallisFilter Example // Apply a Wallis Filter to the image // Same as: ImageEnView1.Proc.WallisFilter(); Effect.Add( peAutoEnhance ); Effect.CurrentItem.AutoEnhance_Method := AutoEnhanceMethod_WallisFilter; // Only default parameters used for: AutoEnhanceMethod_WallisFilter, AutoEnhanceMethod_AdjustGainOffset, AutoEnhanceMethod_WhiteBalance_AutoWhite Effect.Apply();
Color Curve Example // Apply a color curve to the image Effect.Add( peColorCurve ); Effect.CurrentItem.ColorCurve_CurvePoints := '0,0,112,73,255,255|0,0,255,255|0,0,255,255|0,0,255,255'; Effect.CurrentItem.ColorCurve_Channel := ieccRGB Effect.Apply();
Cropping Example // Crop 25% of all sides of the image // Same as: ImageEnView1.Proc.Crop( bmp.Width div 4, bmp.Height div 4, MulDiv( bmp.Width, 3, 4 ), MulDiv( bmp, 3, 4 )); Effect.Add( peCrop ); Effect.CurrentItem.Crop_Left := bmp.Width div 4; Effect.CurrentItem.Crop_Top := bmp.Height div 4; Effect.CurrentItem.Crop_Right := bmp.Width div 4; Effect.CurrentItem.Crop_Bottom := bmp.Height div 4; Effect.Apply();
Equalization - AutoEqualize Example // Equalizes the color histogram of the selected region // Same as: ImageEnView1.Proc.HistAutoEqualize(); Effect.Add( peEqualize ); Effect.CurrentItem.Equalization_AutoEqualize := True; Effect.Apply();
Lens Effects Example // Apply a lens effect to the center of the image // Same as: ImageEnView1.Proc.Lens( bmp.Width div 2, bmp.Height div 2, bmp.Width, bmp.Height, 6 ); Effect.Add( peLens ); Effect.CurrentItem.Lens_Left := bmp.Width,div 2; Effect.CurrentItem.Lens_Top := bmp.Height div 2; Effect.CurrentItem.Lens_Width := bmp.Width; Effect.CurrentItem.Lens_Height := bmp.Height; Effect.CurrentItem.Lens_Ref := 6.0; Effect.CurrentItem.Lens_Auto := False; Effect.Apply();
Morphing - Opening Example // Perform an erosion followed by a dilation // Same as: ImageEnView1.Proc.Opening( 1 ); Effect.Add( peMorph ); Effect.CurrentItem.Morph_Filter := MorphFilter_Opening; Effect.CurrentItem.Morph_WinSize := 1; Effect.Apply();
Morphing - Closing Example // Perform a dilation followed by an erosion // Same as: ImageEnView1.Proc.Closing( 1 ); Effect.Add( peMorph ); Effect.CurrentItem.Morph_Filter := MorphFilter_Closing; Effect.CurrentItem.Morph_WinSize := 1; Effect.Apply();
Morphing - Minimum Example // Set each pixel to the minimum value of all pixel values in the neighborhood // Same as: ImageEnView1.Proc.Minimum( 1 ); Effect.Add( peMorph ); Effect.CurrentItem.Morph_Filter := MorphFilter_Minimum; Effect.CurrentItem.Morph_WinSize := 1; Effect.Apply();
Morphing - Maximum Example // Set each pixel to the maximum value of all pixel values in the neighborhood // Same as: ImageEnView1.Proc.Maximum( 1 ); Effect.Add( peMorph ); Effect.CurrentItem.Morph_Filter := MorphFilter_Maximum; Effect.CurrentItem.Morph_WinSize := 1; Effect.Apply();
Pixelization Example // Apply pixelation to the selection (with blocks of 2% of image width+height) // Same as: ImageEnView1.Proc.Pixelize( 0.02 ); Effect.Add( pePixelize ); Effect.CurrentItem.Pixelize_BlockSize := 0.02; Effect.Apply();
Resampling Example // Resize the image so that it is no higher or wider than 100, but maintains the original aspect ratio // Same as: ImageEnView1.Proc.Resample( 100, 100, rfLanczos3, True ); Effect.Add( peResize ); Effect.CurrentItem.Resize_ByPercent := False; Effect.CurrentItem.Resize_Width := 100; Effect.CurrentItem.Resize_Height := 100; Effect.CurrentItem.Resize_MaintainAR := True; Effect.CurrentItem.Resize_QualityFilter := rfLanczos3; Effect.Apply();
RGB Example // Apply a Red filter (subtracts the Green and Blue channels) // Same as: ImageEnView1.Proc.IntensityRGBAll( 0, -255, -255 ); Effect.Add( peRGB ); Effect.CurrentItem.RGB_R := 0; Effect.CurrentItem.RGB_G := -255; Effect.CurrentItem.RGB_B := -255; Effect.Apply();
Smoothing - Bilateral Example // Smooth image using Bilateral // Same as: ImageEnView1.IEBitmap.GetIEVisionImage().smooth( ievBILATERAL, 5, 0, 30, 30 ); Effect.Add( peSmoothing ); Effect.CurrentItem.Smooth_Method := SmoothMethod_Smooth_Bilateral; Effect.CurrentItem.Smooth_Strength := 3; // Smooth_Strength*10 is used for param3 and param4. Param1 is 5 for ievBILATERAL Effect.Apply();
Smoothing - Median Example // Smooth image using Median // Same as: ImageEnView1.IEBitmap.GetIEVisionImage().smooth( ievMEDIAN, 3 ); Effect.Add( peSmoothing ); Effect.CurrentItem.Smooth_Method := SmoothMethod_Smooth_Bilateral; Effect.CurrentItem.Smooth_Strength := 3; // Smooth_Strength is used for param1 for ievBLUR, ievGAUSSIAN and ievMEDIAN. param2/3/4 are the default Effect.Apply();
Soft Shadow Example // Add a shadow to the bottom-right of the image // Same as: ImageEnView1.Proc.AddSoftShadow( 5, 4, iespBottomRight ); Effect.Add( peSoftShadow ); Effect.CurrentItem.Shadow_Color := clBlack; Effect.CurrentItem.Shadow_Position := iespBottomRight; // or iespAll for Glow Effect.CurrentItem.Shadow_Radius := 5; Effect.CurrentItem.Shadow_Offset := 4; Effect.Apply();
Inner Shadow Example // Add a red shadow to the inner border of the image // Same as: ImageEnView1.Proc.AddInnerShadow( 10, 0, 0, clRed ); Effect.Add( peSoftShadow ); Effect.CurrentItem.Shadow_Color := clRed; Effect.CurrentItem.Shadow_Position := iespInner; Effect.CurrentItem.Shadow_Radius := 10; Effect.CurrentItem.Shadow_Offset := 0; // All sides Effect.Apply();
Other Color Methods - Colorise Example // Convert to gray levels // Same as: ImageEnView1.Proc.ConvertToGray(); Effect.Add( peOtherColor ); Effect.CurrentItem.OtherColor_Method := OtherColor_ConvertToGray; // Only default parameters used for: OtherColor_ConvertToGray, OtherColor_ConvertToSepia, OtherColor_Negative, OtherColor_WhiteBalance_GrayWorld Effect.Apply();
Other Examples // Display Effects Dialog with state saved between sessions if FileExists( 'D:\State.dat' ) then ImageEnView1.Proc.IPDialogParams.LoadFromFile( 'D:\State.dat' ); ImageEnView1.Proc.DoPreviews( ppeSpecialEffects ); ImageEnView1.Proc.IPDialogParams.SaveToFile( 'D:\State.dat' );
// Default to the Rotate page ImageEnView1.Proc.IPDialogParams.Operation := peRotate; ImageEnView1.Proc.IPDialogParams.Rotate_Angle := 45; ImageEnView1.Proc.DoPreviews( ppeEditingFunctions );
// Display the operation performed in the Previews dialog if ImageEnView1.Proc.DoPreviews( ppeEditingFunctions ) then Caption := ImageEnView1.Proc.IPDialogParams.Description();
// Apply chain of editing operations to an image var op: TIEImageEffect; begin ImageEnView1.IO.LoadFromFile( 'D:\image.jpg' ); ImageEnView1.IEBitmap.EffectsChain.Enabled := True;
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; ImageEnView1.IEBitmap.EffectsChain.Add( op );
// Prompt the user for an image editing effect and add it to our Effects Chain (TIEImageEffectsList) op := TIEImageEffect.Create(); try if ImageEnView1.Proc.DoPreviews( ppeEditingFunctions, op ) then begin EffectsChain.Add( op ); ListBox1.Items.Add( op.Description() ); end; finally op.Free; end;