We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Create new image

How can I create a new (blank) image with the ImageEditor?
It does not seem possible.

4 Replies

MK Muneesh Kumar G Syncfusion Team March 15, 2019 12:23 AM

Hi Christian, 
 
Greetings from Syncfusion. 
 
We have analyzed your requirement and you can achieve this by adding custom toolbar item to SfImageEditor and set ImageSource as null in ToobarItemSelected as per the below code snippet.  
 
Code snippet 
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"  > 
         
      <image:SfImageEditor x:Name="imageEditor" ImageSource="floordiagram.png"></image:SfImageEditor> 
         
    </Grid> 
 
public MainPage() 
        { 
            this.InitializeComponent(); 
 
            FooterToolbarItem toolbarItem = new FooterToolbarItem(); 
            toolbarItem.Text = "New"; 
            
            imageEditor.ToolbarSettings.ToolbarItems.Add(toolbarItem); 
 
            imageEditor.ToolbarSettings.ToolbarItemSelected += ToolbarSettings_ToolbarItemSelected; 
        } 
 
        private void ToolbarSettings_ToolbarItemSelected(object sender, ToolbarItemSelectedEventArgs e) 
        { 
            if (e.ToolbarItem.Text == "New") 
                imageEditor.ImageSource = null; 
        } 
 
We have prepared a sample based on this, please find the sample from the following location.  
 
 
Screenshot: 
 
 
Hope it helps you.  
 
Thanks, 
Muneesh Kumar G. 



CH Christian March 15, 2019 06:20 AM

Well, this does create a new image, but it crashes when you save the new image.
"Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."

Reproduce:

1) Run the sample UWP_Sample-860035795
2) Click "New"
3) Draw a line on the blank canvas
4) Click "Save"

The problem is that the ImageEditor Stream is null.



SA Santhiya Arulsamy Syncfusion Team March 20, 2019 08:13 AM

Hi Christian, 
 
Sorry for the inconvenience caused. 
 
We can reproduce the issue and we confirmed “Exception thrown when saving the ImageEditor without adding the image” as an issue. We will provide the patch on 2nd April,2019. We appreciate your patience until then.  
You can now track the status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
 
Thanks, 
Santhiya A 



RS Ramya Soundar Rajan Syncfusion Team February 19, 2020 04:44 AM

Hi Christian, 
 
We would like to let you know that the reported issue ““Exception thrown when saving the ImageEditor without adding the image” has already been moved. So, please check with our latest NuGet 17.4.0.50 and let us know.  
 
Regards, 
Ramya S 


Loader.
Live Chat Icon For mobile
Up arrow icon