This project has moved and is read-only. For the latest updates, please go here.

Monitoring progress for effects

Dec 9, 2015 at 10:05 PM
Hi Dirk,

Is there a way to get the progress of an effect that takes a long time to process? For example, if I run a strong Median blur or Kuwahara on a large (4k, for example) image - it takes several minutes (90+ in one case). The speed is not a problem, but I'd like to show the progress so the user does not think the process is hung.

I haven't been able to find a way to monitor such progress. I tried using the logging functionality to see if it exposes something, but so far I think I can only find read/write and similar "logistical" events, but not processing progress.

Is there an ad hoc way of monitoring such progress without having to have you write new code into the library? Or maybe there is such functionality and I just missed it! :)

Thanks,
Dax
Dec 10, 2015 at 12:11 PM
Edited Dec 10, 2015 at 12:14 PM
Internally in ImageMagick there is a way to monitor progress of certain methods. I have not yet exposed this method in the C# API. I am now doing a huge rewrite of Magick.NET to use P/Invoke instead of CLI/C++ but I can add this when that is done. I will create an issue for this so I won't forget this :)

p.s. your website shows a compilation error.
Dec 10, 2015 at 12:12 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 10, 2015 at 1:35 PM
Thanks for making the issue. :) If I think of anything relevant to add, I'll post a comment there.

Wow - P/Invoke sounds good. So you would end up bypassing the whole VC++ wrapper and just invoke the libs directly? I'm guessing that would be a nice performance boost as well as it would take away one of the bridge layers.

I've been experimenting with my server (moving to Azure) so my personal site is super messed up right now. :D
Dec 10, 2015 at 2:45 PM
In the P/Invoke version the Magick++ code will be completely removed. I will create new 'wrapper' that will only contain C. I do need to create some kind of wrapper because the way exceptions are raised in the ImageMagick library. I have not yet noticed a performance improvement. And I wonder if that will happen because I just removed a 'method that calls method' layer.
Feb 11, 2016 at 3:33 PM
Hello,
I want to monitor progress for image write opération. I open a psd file that is quite huge (250Mo) et try to write it in png. It takes several minutes so I want to feedback the write progress to the user. Is it possible or it is available only for effects ?
Feb 11, 2016 at 4:12 PM
Edited Feb 11, 2016 at 4:12 PM
I am not sure if all image formats report progress when the file is being written. Have you checked what happens when you attach the event right before you write it? With the help of the 'Origin' property you should be able to determine the action that occurred.
Feb 11, 2016 at 5:47 PM
Edited Feb 11, 2016 at 5:51 PM
Thanks a lot for your very fast answer. It works well now. I was working with an outdated version (1.0.0.22). The image class did not have the Progress event. Very sorry for the inconvenience.
Thanks again!
Feb 11, 2016 at 8:11 PM
I just did a quick check of the PNG coder and it turns out that the Origin for the PNG writer is incorrect. It now uses 'Load/Image' instead of 'Save/Image' when you write it. This will be fixed in the next release of Magick.NET that will be released this weekend.