Image Effects in .NET MAUI Image Editor (SfImageEditor)

21 Jul 202610 minutes to read

Using the .NET MAUI Image Editor control, you can apply effects such as Brightness, Hue, Saturation, Contrast, Blur, Opacity, Exposure, and Sharpen to an image. You can apply these effects by using the built-in toolbar or by calling the ImageEffect method, which accepts two arguments: an ImageEffect enum value and an EffectValue (a double).

The ImageEffect enum includes the following values:

  • Brightness
  • Blur
  • Contrast
  • Exposure
  • Hue
  • Saturation
  • Sharpen
  • Opacity
  • None

The valid range of the EffectValue argument varies for each effect, as explained in the following sections.

NOTE

The ImageEffect enum includes a None value that removes all applied effects that have not been saved.

NOTE

The ImageEffect method only applies the effect to the preview image. To save the applied effect, call the SaveEdits method.

Brightness

Adjusts the overall lightness or darkness of the image. The value ranges from -1 to 1, with a default of 0.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="Brightness"
            Clicked="OnBrightnessClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnBrightnessClicked(object sender, EventArgs e)
{
    this.imageEditor.ImageEffect(ImageEffect.Brightness, -0.6);
}

Brightness effect in .NET MAUI Image Editor

Blur

Creates a soft, unfocused appearance by reducing the image’s sharpness. The value ranges from 0 to 1, with a default of 0.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="Blur"
            Clicked="OnBlurClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnBlurClicked(object sender, EventArgs e)
{
    this.imageEditor.ImageEffect(ImageEffect.Blur, 0.5);
}

Blur effect in .NET MAUI Image Editor

Contrast

Increases or decreases the difference between the light and dark areas of the image, making it more visually distinct. The value ranges from -1 to 1, with a default of 0.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="Contrast"
            Clicked="OnContrastClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnContrastClicked(object sender, EventArgs e)
{
    this.imageEditor.ImageEffect(ImageEffect.Contrast, -0.8);
}

Contrast effect in .NET MAUI Image Editor

Exposure

Alters the overall brightness and darkness levels of the image. The value ranges from -1 to 1, with a default of 0.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="Exposure"
            Clicked="OnExposureClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnExposureClicked(object sender, EventArgs e)
{
    this.imageEditor.ImageEffect(ImageEffect.Exposure, -0.4);
}

Exposure effect in .NET MAUI Image Editor

Hue

Shifts the color spectrum of the image. The value ranges from -1 to 1, with a default of 0.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="Hue"
            Clicked="OnHueClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnHueClicked(object sender, EventArgs e)
{
    this.imageEditor.ImageEffect(ImageEffect.Hue, 0.2);
}

Hue effect in .NET MAUI Image Editor

Saturation

Enhances or reduces the intensity and vividness of colors in the image. The value ranges from -1 to 1, with a default of 0.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="Saturation"
            Clicked="OnSaturationClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnSaturationClicked(object sender, EventArgs e)
{
    this.imageEditor.ImageEffect(ImageEffect.Saturation, -0.8);
}

Saturation effect in .NET MAUI Image Editor

Sharpen

Enhances the clarity and definition of edges and details in the image. The value ranges from 0 to 6, with a default of 0.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="Sharpen"
            Clicked="OnSharpenClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnSharpenClicked(object sender, EventArgs e)
{
    this.imageEditor.ImageEffect(ImageEffect.Sharpen, 0.5);
}

Sharpen effect in .NET MAUI Image Editor

Opacity

Controls the transparency or visibility of the image. The value ranges from 0 to 1, with a default of 1.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="Opacity"
            Clicked="OnOpacityClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnOpacityClicked(object sender, EventArgs e)
{
    this.imageEditor.ImageEffect(ImageEffect.Opacity, 0.5);
}

Opacity in .NET MAUI Image Editor

Save or cancel applied effects

Call the SaveEdits method to save the applied effects to the view; otherwise, the effects will be reset on the next action.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="SaveEdits"
            Clicked="OnSaveEditsClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnSaveEditsClicked(object sender, EventArgs e)
{
    this.imageEditor.SaveEdits();
}

Cancel the applied effects by using the CancelEdits method or by calling the ImageEffect method with ImageEffect.None.

<Grid RowDefinitions="0.9*, 0.1*">
    <imageEditor:SfImageEditor x:Name="imageEditor"
                               Source="image.jpeg" />
    <Button Grid.Row="1"
            Text="CancelEdits"
            Clicked="OnCancelEditsClicked" />
</Grid>
using Syncfusion.Maui.ImageEditor;

private void OnCancelEditsClicked(object sender, EventArgs e)
{
    this.imageEditor.CancelEdits();
}
using Syncfusion.Maui.ImageEditor;

this.imageEditor.ImageEffect(ImageEffect.None, 0);