Saving an image with the image editor when closing a window

Hi!

I have an issue saving an image using the Window.Closing Event. My goal is to save the image in a directory on clicking the close button of the window. However, the ImageSaved event won't be called before the Window destructs itself so the modified image won't be saved, and also I can't transmit the image path to another function, even though I called the Save method of the image editor. Putting a Messagebox after the Save method seems to solve the problem because of the delay. So my question is, if there is any way of knowing when the image actually gets saved, so the window won't destruct itself before the Editor_Imagesaved event happens?

I look forward to your kind reply.




3 Replies

VO Vishal Omprasad Syncfusion Team July 20, 2023 01:39 PM UTC

Hi Mihaly,

Currently, we are analyzing your query. We will validate and update you with further details shortly. We appreciate your patience until then.

Regards,

Vishal O.



UN Unknown July 20, 2023 07:47 PM UTC

Hi Vishal Omprasad,


Thank you, for your reply. I managed to solve that problem as shown in the following code that I attached, but that might not be the cleanest solution. And there I found another problem. After the ImageSaved event finishes, the image file has a size of 0 byte in the folder I save it into, so it seems like that the file is not created entirely even after that event. I tried to save a modified image using the default save button in the editor as well, and trying to open the same image from there, but the same problem occurs.







VO Vishal Omprasad Syncfusion Team July 24, 2023 12:22 PM UTC

Hi Mihaly,

As per the shared information, we have checked the reported query “Issue with saving the image in Window.Closing event” but we are unable to reproduce the issue from our end. We have checked the scenarios saving the image through a button click and also when closing the window and the image got saved to the corresponding location provided. We have shared the tested sample and the tested output video below for your reference. Please check our sample and let us know if you are still facing the same issue.

Additional information:

SfImageEditor version: 22.1.39

The size of the image used for testing is 49 KB.

If the shared information does not meet your requirement, kindly revert us back with the following information which would help us to provide a better solution.

  • Share issue reproducible video.

  • Share issue reproducible sample.

  • Share the image or the size of the image used.

Regards,

Vishal O.


Attachment: ImageEditorDemo_658bd55.zip

Loader.
Up arrow icon