New to Telerik UI for WPFStart a free 30-day trial

Import/Export

Updated on Jan 6, 2026

RadImageEditor can load and save images in different file formats. This functionality is implemented through format providers. The format providers shipped with the control are:

  • PngFormatProvider—allows import and export from/to PNG;
  • BmpFormatProvider—allows import and export from/to BMP;
  • JpegFormatProvider—allows import only from JPEG/JPG.

As RadImageEditor is highly extensible, you can create your own format providers by implementing the IImageFormatProvider interface. This approach is illustrated in a demo attached to this blog post, showing how a format provider that supports both import and export from JPEG can be developed and plugged in RadImageEditor’s architecture.

The format providers can load images from streams and bytes just like shown in the following.

Load an image

C#
	this.imageEditor.Image = formatProvider.Import(stream);

The below code shows how to load an image from a file using the open file dialog.

Load an image through the OpenFileDialog

C#
	private void AddImageInEditor()
	{
	    OpenFileDialog ofd = new OpenFileDialog();
	    ofd.Filter = "PNG Images (*.png)|*.png|JPEG Images (*.jpg,*.jpeg)|*.jpg;*.jpeg|All images|*.*";
	    ofd.FilterIndex = 3;
	    if (ofd.ShowDialog() == true)
	    {
	        string extension = Path.GetExtension(ofd.SafeFileName).ToLower();
	        Stream stream = ofd.OpenFile();
	        IImageFormatProvider formatProvider = ImageFormatProviderManager.GetFormatProviderByExtension(extension);
	        if (formatProvider == null)
	        {
	            StringBuilder sb = new StringBuilder();
	            sb.Append("Unable to find format provider for extension: ")
	              .Append(extension).Append(" .");
	            return;
	        }
	        else
	        {
	            this.imageEditor.Image = formatProvider.Import(stream);
	        }
	    }
	}

You can use the available format providers to export the images as well. The following example shows how you can get the image of the editor, encode it in a specific format – BMP or PNG, and save it using the SaveFileDialog.

Save an image through the SaveFileDialog

C#
	private void ExportImageInEditor()
	{
	    SaveFileDialog sfd = new SaveFileDialog();
	    sfd.Filter = "PNG Images (*.png)|*.png|BMP Images (*.bmp)|*.bmp;*|All images|*.*";
	    sfd.FilterIndex = 3;
	    if (sfd.ShowDialog() == true)
	    {
	        string extension = System.IO.Path.GetExtension(sfd.SafeFileName).ToLower();
	        Stream stream = sfd.OpenFile();
	        IImageFormatProvider formatProvider = ImageFormatProviderManager.GetFormatProviderByExtension(extension);
	        if (formatProvider == null)
	        {
	            StringBuilder sb = new StringBuilder();
	            sb.Append("Unable to find format provider for extension: ")
	                .Append(extension).Append(" .");
	            return;
	        }
	        else
	        {
	            using (stream)
	            {
	                formatProvider.Export(this.imageEditorUI.ImageEditor.Image, stream);
	            }
	        }
	    }
	}

One thing to note is that the last applied change may not be committed (which normally happens when you press Enter or change the current tool).

To commit this last change, use the CommitTool method of the RadImageEditor class as shown in the example below.

Commit a change

C#
	this.imageEditorUI.ImageEditor.CommitTool();

ImageFormatProviderManager

The ImageFormatProviderManager class is a static class that manages the format providers available for RadImageEditor. It exposes methods to register format providers as well as to get a format provider by file extension.

  • RegisteredFormatProviders—gets a collection of all registered format providers.
  • RegisterFormatProvider—this method allows you to register a format provider of the type IImageFormatProvider.
  • GetFormatProviderByExtension—this method returns a registered format provider by passing a string parameter that represents the file extension. For example, ".png".

Registering a format provider

C#
	ImageFormatProviderManager.RegisterFormatProvider(new Jpeg2000FormatProvider());

To download a runnable project with the example from this article, visit our SDK repository. You can find the example in the ImageEditor/CustomImageFormatProvider folder.

See Also