What’s New in 2019 Volume 3: Xamarin Image Editor | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (175).NET Core  (29).NET MAUI  (208)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (220)BoldSign  (15)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (67)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (101)Streamlit  (1)Succinctly series  (131)Syncfusion  (920)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (37)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (151)Chart  (132)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (633)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (41)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (508)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (11)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (597)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Image Editor Xamarin

What’s New in 2019 Volume 3: Xamarin Image Editor

Every release since its debut, we’ve made improvements and added useful features to our Xamarin.Forms Image Editor control. We’ve continued this effort in the 2019 Volume 3 release, where we added the following new features:

  • Support for image filter effects.
  • Option to add read-only text.
  • Provision to enable or disable resize functionality for added objects.

In this blog, I’m going to explain these new features with examples.

Image filter effects support

The Image Editor filter effects allow users to apply different color filters to an image. This feature is used to manipulate the colors of existing images, enhancing their color and texture. The Image Editor control offers six types of image effects options:

  • Hue
  • Saturation
  • Brightness
  • Contrast
  • Blur
  • Sharpen

The effects can be applied either through the Image Editor toolbar or through code by using the ApplyImageEffect method.

Next, I will demonstrate applying individual filters to the following image.

Original Image
Original Image

Hue

The hue represents the dominant wavelength of the color in an image. The value of the hue effect ranges from -180 to 180. The value 0 means there is no change in the hue effect and the image is displayed with its original color. To apply the hue effect to an image, use Hue option in toolbar, or use either the following XAML or C# code:

<imageeditor:SfImageEditor Source="{Binding Image}" x:Name="imageEditor"  ImageEffect="Hue" EffectValue="-90" >
imageEditor.ApplyImageEffect(ImageEffect.Hue, -90);
Image with Hue Set to -90
Image with Hue Set to -90

Saturation

The saturation is the intensity of the color. The value of the saturation effect ranges from -100 to 100. The value 0 means there is no change in the saturation effect and the image is presented in its original color. If the value is -100, the image will be black and white. If the value is 100, the image color will be oversaturated. To apply the saturation effect to the image, use the Saturation option in the toolbar, or use either the following XAML or C# code.

<imageeditor:SfImageEditor Source="{Binding Image}" x:Name="imageEditor"  ImageEffect="Saturation" EffectValue="-80" >
imageEditor.ApplyImageEffect(ImageEffect.Saturation, -80);
Image with Saturation Set to -80
Image with Saturation Set to -80

Brightness

The brightness represents how bright the color of an image is. The value of the brightness effect ranges between -100 and 100. The value 0 means there is no change in the brightness and the image is displayed in its original color. Positive values increase the brightness of an image and negative values decrease it. When the value is 100, the image will be at full brightness and appear completely white. When the value is -100, there is no brightness, making the image appear black. To apply the brightness effect to the image, use the Brightness option in the toolbar, or use either the following XAML or C# code:

<imageeditor:SfImageEditor Source="{Binding Image}" x:Name="imageEditor"  ImageEffect="Brighness" EffectValue="-20" >
imageEditor.ApplyImageEffect(ImageEffect.Brightness, -20);
Image with Brightness Set to -80
Image with Brightness Set to -80

Contrast

The contrast represents the difference between colors in an image. The value of contrast ranges from -100 to 100. The value 0 means there is no change in the contrast effect and the image is its original color. The value -100 will result in a completely grayscale image, and the value 100 will result in an over-contrasted image. To apply the contrast effect to the image, use the Contrast option in the toolbar, or use either the following XAML or C# code.

<imageeditor:SfImageEditor Source="{Binding Image}" x:Name="imageEditor"  ImageEffect="Contrast" EffectValue="75" >
imageEditor.ApplyImageEffect(ImageEffect.Contrast, 75);
Image with Contrast Set to 75
Image with Contrast Set to 75

Blur

The blur represents the clarity of the image. The blur effect value ranges from 0 to 6. The value 0 means there is no change in the image, and the blurring of the image will increase based on the increased effect value. To apply the blur effect to the image, use the Blur option in toolbar, or use either the following XAML or C# code.

<imageeditor:SfImageEditor Source="{Binding Image}" x:Name="imageEditor"  ImageEffect="Blur" EffectValue="2" >
imageEditor.ApplyImageEffect(ImageEffect.Blur, 2);
Image with Blur Set to 2
Image with Blur Set to 2

Sharpen

Sharpen is used to highlight and enhance the edges of objects in an image. The sharpen effect value ranges from 0 to 6. The value 0 means there is no change in the image, and the sharpness of the image increases based on the increased effect value. To apply the sharpen effect to the image, use the Sharpen option in the toolbar, or use either the following XAML or C# code.

<imageeditor:SfImageEditor Source="{Binding Image}" x:Name="imageEditor"  ImageEffect="Sharpen" EffectValue="3" >
imageEditor.ApplyImageEffect(ImageEffect.Sharpen, 3);
Image with Sharpen Set to 3
Image with Sharpen Set to 3

Create custom color styles for images

By applying a combination of different filter effects to an image, you can create your own image color style as shown in the next image. For example, use the following code to create a limestone color style and apply it to an image.

if(item.ImageName == "Limestone")
{
     imageEditor.ApplyImageEffect(ImageEffect.Hue, -147);
     imageEditor.ApplyImageEffect(ImageEffect.Saturation, 84);
     imageEditor.ApplyImageEffect(ImageEffect.Brightness, -16);
     imageEditor.ApplyImageEffect(ImageEffect.Contrast, 14);
}
Image with a combination of different filter effects
Image with a combination of different filter effects

You can download this custom color style demo from GitHub.

Option to add read-only text

Now, the Image Editor also supports adding read-only text by restricting the text pop-up while tapping on added text. To add read-only text, set the IsEditable property in TextSettings to false before adding the text. By default, this property is set to true.

imageEditor.AddText("text", new TextSettings { IsEditable = false });

Provision to enable or disable resize functionality of added objects

Now, you can also control the resizing functionality of added images, shapes, and custom views by using the IsResizable property of PenSettings, TextSettings, and CustomViewSettings in the Image Editor as shown in the following code.

image.AddShape(ShapeType.Rectangle, new PenSettings { Color = Color.Red, Bounds = new Rectangle(20, 20, 35, 35), IsResizable = false });

Conclusion

In addition to these features, we have included some minor improvements and bug fixes. Try out these new features and enhancements in our 2019 Volume 3 release.

If you don’t have a Syncfusion license, but would like to try out these new features, you can sign up for a free 30-day trial.

If you have any questions about these features, please let us know in the comments below. You can also contact us through our support forumDirect-Trac, or our feedback portal. We are happy to assist you!

We hope you will also like the following posts:

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed