Hi,
I'm create a Image Editor Popup by using SfImageEditor and an OK button. When the OK button clicked, the image editor SaveEdits() called, however it's not works.
For example, I change the brightness and contrast, then clicked the SaveEdits button in toolbar. It works properly.
If I click OK button, it doesn't work.
How can I use the SaveEdits() instead of the SaveEdits button in the toolbar?
Additionally, how can I change the tooltip text in Toolbar button?
Thanks and best regards,
TH
Hi Thanh,
Regarding query” When the OK button clicked, the image editor SaveEdits() called, however it's not works.”
Thank you for reaching out to us. Based on the information you provided, we have investigated your query but were unable to replicate the issue on our end. In our tests, we loaded the image editor inside a pop up, and when the OK button was clicked, the SaveEdits method was called, and the edits were saved without any problems.
We have attached the tested
sample for your reference. Please review it and let us know if you still
encounter the issue. If not, kindly modify our sample to replicate the issue or
share the sample where you encountered this problem. This will help us
investigate further.
As for your second query: "How can I change the tooltip text in the Toolbar button?" We are currently checking this and will update you with further details shortly.
Regards,
Vidyalakshmi M.
Hi Thanh,
Regarding query” When the OK button clicked, the image editor SaveEdits() called, however it's not works.”
Thank you for reaching out to us. Based on the information you provided, we have investigated your query but were unable to replicate the issue on our end. In our tests, we loaded the image editor inside a pop up, and when the OK button was clicked, the SaveEdits method was called, and the edits were saved without any problems.
We have attached the tested
sample for your reference. Please review it and let us know if you still
encounter the issue. If not, kindly modify our sample to replicate the issue or
share the sample where you encountered this problem. This will help us
investigate further.
As for your second query: "How can I change the tooltip text in the Toolbar button?" We are currently checking this and will update you with further details shortly.
Regards,
Vidyalakshmi M.
Hi Vidyalakshmi M,
Sorry, I've not descripted my issue in detail. When button Ok clicked, I called the SavedEdits() method and use GetImageStream() to get stream. The stream will be used to create a stamp annotation. And the annotation was still shown with original image.
Here is my code:
imageEditor.Dispatcher.Dispatch(() => imageEditor.SaveEdits());
await using var imageStream = await imageEditor.GetImageStream();
using var memoryStream = new MemoryStream();
await imageStream.CopyToAsync(memoryStream);
// Close popup and create new annotation here.
How can I fix this issue?
Thanks and best regards,
TH
Hi Thanh,
Regarding the issue with the "SaveEdits" method not functioning properly:
We tested the code you provided by incorporating it into the "OK" button's click event, and the edits were saved as expected without any issues. For your reference, we have attached the tested sample. Please review it and let us know if you're still encountering the same problem. If not, kindly share the sample project where you’re facing this issue so we can investigate further and provide an appropriate solution.
Regarding changing the tooltip text on toolbar buttons:
Currently, there's no support to modify the tooltip text for toolbar items. However, we’ve logged a feature request to add support for customizing tooltips for toolbar items, and we plan to implement this feature in one of our upcoming releases. We'll notify you when this feature becomes available. In the meantime, you can track its progress through the following feedback link: Tooltip-template-support-for-toolbar-items
Regards,
Vidyalakshmi M.
Hi Vidyalakshmi ,
According to your example, I tried to change the brightness value. Then, I saved the stream to a PNG file. I also used Save() method to create another file. However, both of them are applied the brightness effect.
Here is my code:
private async void OkButtonClicked(object sender, EventArgs e)
{
imageEditor.Dispatcher.Dispatch(() => imageEditor.SaveEdits());
await using var imageStream = await imageEditor.GetImageStream();
using var fileStream = File.Create("C:\\TH\\SourceCode\\sample\\SampleCodes\\ImageEditorPopupSample_e8a3e42\\sample.png");
await imageStream.CopyToAsync(fileStream);
imageEditor.Save(ImageFileType.Png, "C:\\TH\\SourceCode\\sample\\SampleCodes\\ImageEditorPopupSample_e8a3e42");
}
Please help me to check the issue.
Thanks and best regards,
TH
Hi Thanh,
We have checked the code snippets you shared and the `SaveEdits` method is functioning properly. We've attached a tested sample for your reference.
Please note that when the `SaveEdits` method is called, the edits currently present in the view will be saved. Additionally, the `GetImageStream` method retrieves the image currently displayed in the view as a stream.
Could you let us know which platform you're encountering the issue on? Also, it would be helpful if you could provide more details about your specific requirements. This will enable us to provide a more suitable solution to meet your needs.
Regards,
Vidyalakshmi M.
Hi,
I'm encountering the issue on Windows, and I just get the image, which was edited by applying effect ( brightness, contrast,..), as stream, then use this stream for the other actions. As I mention in previous replies, If I click the saved edits buttons in SfImageEditor toolbar then click OK, the stream is ok. If I click OK the stream of image doesn't contain any effect.
Hi Thanh,
Thank you for sharing the details with us. We tested your code by making edits, such as adjusting the brightness and contrast of the image. The `SaveEdits` method handles image processing tasks, and Invoking it via the dispatcher will execute on the different threads will cause delay, and the GetImageStream method will perform before the save edits action.
To resolve this issue, avoid using the dispatcher and add a delay after calling the `SaveEdits` and `GetImageStream` methods to ensure they are fully executed before proceeding.
After applying these adjustments, the sample is now working as expected. Below is a code snippet for your reference:
|
private async void OkButtonClicked(object sender, EventArgs e) { this.imageEditor.SaveEdits(); await Task.Delay(500); var imageStream = await imageEditor.GetImageStream(); await Task.Delay(500); using var fileStream = File.Create("D:\\ImageEditorPopupSample\\sample.png"); await imageStream.CopyToAsync(fileStream); imageEditor.Save(ImageFileType.Png, "D:\\ImageEditorPopupSample");
}
|
We’ve also attached the modified sample for you to review. Please let us know if you have any further questions or need additional assistance.
Regards,
Vidyalakshmi M.
Thank you for your effort. I've created a sample to combine some issues, which I encountered, at https://www.syncfusion.com/forums/194610/some-issues-with-annotation-and-redact?reply=zybkrz.
Please take a look.
Thanks and best regards,
TH
Hi Thanh,
Please check the following forum link for further updates: https://www.syncfusion.com/forums/194610/some-issues-with-annotation-and-redact?reply=zybkrz
If you have any other questions or need assistance, please let us know.
Regards,
Vidyalakshmi M.