How can I help you?
Getting Started with the .NET MAUI ImageEditor
11 Jun 202615 minutes to read
This section explains the steps to create and load an image to the .Net MAUI ImageEditor(SfImageEditor) control. Follow the steps below to add .NET MAUI ImageEditor control to your project.
To get start quickly with our .NET MAUI ImageEditor, you can check the below video.
Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with Visual Studio 2022 v17.12 or later.
Step 1: Create a New .NET MAUI Project
- Go to File > New > Project and choose the .NET MAUI App template.
- Name the project and choose a location. Then click Next.
- Select the .NET framework version and click Create.
Step 2: Install the Syncfusion® .NET MAUI ImageEditor NuGet Package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.ImageEditor and install the latest version.
- Ensure the necessary dependencies are installed correctly, and the project is restored.
Step 3: Register the handler
The Syncfusion.Maui.Core NuGet is a dependent package for all Syncfusion® .NET MAUI controls. In the MauiProgram.cs file, register the handler for Syncfusion® core.
using Syncfusion.Maui.Core.Hosting;
namespace GettingStarted
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.ConfigureSyncfusionCore();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("Segoe-mdl2.ttf", "SegoeMDL2");
});
return builder.Build();
}
}
}Step 4: Add .NET MAUI ImageEditor control
- To initialize the control, import the
Syncfusion.Maui.ImageEditornamespace into your code. - Initialize SfImageEditor.
<ContentPage
. . .
xmlns:imageEditor="clr-namespace:Syncfusion.Maui.ImageEditor;assembly=Syncfusion.Maui.ImageEditor">
<imageEditor:SfImageEditor />
</ContentPage>using Syncfusion.Maui.ImageEditor;
. . .
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
SfImageEditor imageEditor = new SfImageEditor();
this.Content = imageEditor;
}
}Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with Visual Studio Code.
- Ensure that the .NET MAUI workloads are installed and configured as described here.
Step 1: Create a New .NET MAUI Project
- Open the command palette by pressing
Ctrl+Shift+Pand type .NET:New Project and enter. - Choose the .NET MAUI App template.
- Select the project location, type the project name and press Enter.
- Then choose Create project.
Step 2: Install the Syncfusion® .NET MAUI ImageEditor NuGet Package
- Press Ctrl + ` (backtick) to open the integrated terminal in Visual Studio Code.
- Ensure you’re in the project root directory where your .csproj file is located.
- Run the command
dotnet add package Syncfusion.Maui.ImageEditorto install the Syncfusion® .NET MAUI ImageEditor NuGet package. - To ensure all dependencies are installed, run
dotnet restore.
Step 3: Register the handler
The Syncfusion.Maui.Core NuGet is a dependent package for all Syncfusion® .NET MAUI controls. In the MauiProgram.cs file, register the handler for Syncfusion® core.
using Syncfusion.Maui.Core.Hosting;
namespace GettingStarted
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.ConfigureSyncfusionCore();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("Segoe-mdl2.ttf", "SegoeMDL2");
});
return builder.Build();
}
}
}Step 4: Add .NET MAUI ImageEditor control
- To initialize the control, import the
Syncfusion.Maui.ImageEditornamespace into your code. - Initialize SfImageEditor.
<ContentPage
. . .
xmlns:imageEditor="clr-namespace:Syncfusion.Maui.ImageEditor;assembly=Syncfusion.Maui.ImageEditor">
<imageEditor:SfImageEditor />
</ContentPage>using Syncfusion.Maui.ImageEditor;
. . .
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
SfImageEditor imageEditor = new SfImageEditor();
this.Content = imageEditor;
}
}Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with JetBrains Rider 2024.3 or later.
- Make sure the MAUI workloads are installed and configured as described here.
Step 1: Create a new .NET MAUI Project
- Go to File > New Solution, Select .NET (C#) and choose the .NET MAUI App template.
- Enter the Project Name, Solution Name, and Location.
- Select the .NET framework version and click Create.
Step 2: Install the Syncfusion® MAUI ImageEditor NuGet Package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.ImageEditor and install the latest version.
- Ensure the necessary dependencies are installed correctly, and the project is restored. If not, Open the Terminal in Rider and manually run:
dotnet restore
Step 3: Register the handler
The Syncfusion.Maui.Core NuGet is a dependent package for all Syncfusion® .NET MAUI controls. In the MauiProgram.cs file, register the handler for Syncfusion® core.
using Syncfusion.Maui.Core.Hosting;
namespace GettingStarted
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.ConfigureSyncfusionCore();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("Segoe-mdl2.ttf", "SegoeMDL2");
});
return builder.Build();
}
}
}Step 4: Add .NET MAUI ImageEditor control
- To initialize the control, import the
Syncfusion.Maui.ImageEditornamespace into your code. - Initialize SfImageEditor.
<ContentPage
. . .
xmlns:imageEditor="clr-namespace:Syncfusion.Maui.ImageEditor;assembly=Syncfusion.Maui.ImageEditor">
<imageEditor:SfImageEditor />
</ContentPage>using Syncfusion.Maui.ImageEditor;
. . .
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
SfImageEditor imageEditor = new SfImageEditor();
this.Content = imageEditor;
}
}Step 5: Loading an image to image editor
The Source property is used to load images from different sources:
NOTE
You can load image formats such as JPEG, PNG, and BMP to the image editor.
Loading a local file
To load an image from a local path. The following code shows adding an image to the image editor control with the format as “JPEG” and name as “image.”
<ContentPage
. . .
<imageEditor:SfImageEditor Source="D:\images\image.jpeg"/>
</ContentPage>using Syncfusion.Maui.ImageEditor;
namespace SyncfusionImageEditor;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
SfImageEditor imageEditor = new SfImageEditor();
imageEditor.Source = ImageSource.FromFile("D:\\images\\image.jpeg");
this.content = imageEditor;
}
}Load an image from URI
To load an image from a remote URI, you can use the following code example.
<ContentPage
. . .
<imageEditor:SfImageEditor Source="https://dummyimage.com/300x200/000/fff.png"/>
</ContentPage>using Syncfusion.Maui.ImageEditor;
namespace SyncfusionImageEditor;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
SfImageEditor imageEditor = new SfImageEditor();
imageEditor.Source = ImageSource.FromUri(new Uri("https://dummyimage.com/300x200/000/fff.png"));
this.content = imageEditor;
}
}NOTE
To load an URI image on iOS platform, you need to set the App Transport Security (ATS) configuration in the Info.plist file.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>Load an image from Resource folder
To load an image from a resource file.
Refer to the following steps to add an image to the project:
- Locate the “Resources” folder in your .NET MAUI project. This folder is typically located in the project’s root directory.
- Right-click on the “Resources” folder in the project structure view or Solution Explorer.
- From the context menu, select “Add” and then “Existing Item.” This will open a file selection dialog.
- Browse to the location on your computer where the image file is stored.
- Select the image file you want to add to the “Resources” folder.
- Click “Add” to add the image file to the project.
- Assign the image name, including its extension, to the Source property of the image editor control.
The following code shows adding an image to the image editor control.
<ContentPage
. . .
<imageEditor:SfImageEditor Source="image.jpeg"/>
</ContentPage>using Syncfusion.Maui.ImageEditor;
namespace SyncfusionImageEditor;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
SfImageEditor imageEditor = new SfImageEditor();
imageEditor.Source = ImageSource.FromResource("MyProject.Resources.Images.image.jpeg");
this.content = imageEditor;
}
}Load an image from stream
To load an image from a byte array, use the provided code example for stream-based loading.
using Syncfusion.Maui.ImageEditor;
using System.Reflection;
namespace SyncfusionImageEditor;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
SfImageEditor imageEditor = new SfImageEditor();
Assembly assembly = Assembly.GetExecutingAssembly();
imageEditor.Source = ImageSource.FromStream(() => assembly.GetManifestResourceStream("MyProject.Resources.Images.image.jpeg"))
this.content = imageEditor;
}
}The following screenshot illustrates the result of the above code.

NOTE
If you set the Stream source with a local variable, the stream will be closed after the image uses it, and you cannot process the stream again. So, we recommend using stream images by creating a new stream instance inside the Lambda function so that you can process them whenever needed.
imageEditor.Source = ImageSource.FromStream(() => new MemoryStream(imageBytes))
NOTE
View sample in GitHub. You can also explore our .NET MAUI Image Editor Example that shows you how to render the Image Editor in .NET MAUI.