2018 Volume 1: Image Editor in Xamarin.Forms | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (174).NET Core  (29).NET MAUI  (207)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (215)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (100)Streamlit  (1)Succinctly series  (131)Syncfusion  (915)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (147)Chart  (131)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (628)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)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  (507)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  (10)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  (592)What's new  (332)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

2018 Volume 1: Image Editor in Xamarin.Forms

Thank you to those of our customers who provided valuable feedback for improving our image editor! We carefully considered your feedback and consequently improved aspects of the product such as most requested features, stability, and documentation this time. We are excited to share the new features we are including in our upcoming 2018 Volume 1 release for the image editor control in Xamarin.Forms:

  • Localization
  • Serialization
  • Cropping with aspect ratio
  • Moving shapes forward and backward
  • Dynamic adding and removing of toolbar items

Localization

Localization in image editor helps you build your application for a wider audience. You can set text specifically to the culture of your preference in your application. You can localize text in a toolbar item by simply setting the equivalent text in your required culture like in the following code snippet.

//File Location : ProjectName/Resources/Values/String.xml

<resources>

<string name="reset">Reiniciar</string>

<string name="save">Salvar</string>

</resources>

Following is a screen shot of image editor in Spanish.

Reset and save are localized to Spanish

Serialization

If you need to save your UI edits (with all the shapes, paths, and annotated text) for an image so that you can work on the edits later by loading them, this is now possible in image editor. It supports serialization, in which you can save your edits as a stream and load them whenever you need later. The following code snippet shows how you can save and load serialized edits.

//Serialize

 SfImageEditor editor =new SfImageEditor();

 var stream= editor.SaveEdits();

//Deserialize

 SfImageEditor editor =new SfImageEditor();

 editor.LoadEdits(stream);

Saving the edits and loading them again

Cropping with aspect ratio

Image editor already supports cropping images, but now it supports cropping images with aspect ratio, and comes with some default ratios. You can also set or customize your own aspect ratios programmatically, which will be useful in creating ad banners and profile pictures on social networks. Below is a code snippet on cropping an image as a Facebook banner.

//Cropping to 3:2 

SfImageEditor editor =new SfImageEditor(); 

editor.ImageLoaded += (sender, args) => { 
    editor.ToggleCropping(3, 2); 
}; 

//Cropping to 3:1 

SfImageEditor editor =new SfImageEditor(); 

editor.ImageLoaded += (sender, args) => { 
    editor.ToggleCropping(3, 1); 
}; 

 Cropping

Moving the shapes forward or backward

Image editor already supports annotating shapes like rectangles, circles, and arrows. These shapes are arranged one over the other in chronological order when we add them to images, so there will often be a need to change this order while customizing edits. Image editor now supports this functionality and you can bring the required shape forward or backward as you desire.

//Bring to Front

 SfImageEditor editor =new SfImageEditor();
 editor.BringToFront();

//Send to Back

 SfImageEditor editor =new SfImageEditor();
 editor.SendToBack();

//Bring Forward

 SfImageEditor editor =new SfImageEditor();
 editor.BringForward();

//Send Backward

 SfImageEditor editor =new SfImageEditor();
 editor.SendBackward();

Selected shapes can be sent backward or brought forward

Adding/removing toolbar items

Everyone loved our built-in toolbar for the image editor, but there were lot of requests for a way to add a new toolbar item or remove the existing toolbar items from the toolbar. We heard you! Now we support this functionality, and you can add your own toolbar item with an icon and text. For example, let’s say you need to share: you can add a toolbar item with a share icon and trigger an event for the toolbar item click to share the image. Following is a code snippet showing how we can add or remove a toolbar item.

SfImageEditor editor =new SfImageEditor();
HeaderToolBarItem item1 = new HeaderToolBarItem();
item1.Text = “Share”;

//To Add toolbar item
editor.ToolbarSettings.ToolbarItems.Add(item1);

//To Remove toolbar item
editor.ToolbarSettings.ToolbarItems.Remove(item1);

Screenshot shows custom items added to the toolbar to depict the share icon and text

Zooming in UWP:

We provided support for zooming in Android and iOS in our last release and now this feature is available in UWP, as well.

We have demonstrated these new features to show you how handy our image editor control is in developing your customized, feature-rich applications. Syncfusion invites you to try out these features in the upcoming 2018 Volume 1 release, which is expected to roll out in mid-February. Please feel free to provide your valuable feedback in the comments section below.

Tags:

Share this post:

Comments (1)

not able to set Cropping with aspect ratio
editor.Crop(3:1);
Crop method expect a rectangle type as parameter.

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed