views:

748

answers:

0

I am running a Process in a BackgroundWorker to resize images. If I set UseShellExecute = false on the process's startinfo, I get odd behaviour if I do any simultaneous image manipulation with the FreeImageNet library on the UI thread. The odd-behaviour is that when I go to close a new image via CloseMultiBitmap() the method appears to work, but it only leaves FICACHE and FISPOOL files, not the final image. If I set UseShellExecute = true everything works as expected.

The backgroundworker process calls ImageMagick's convert.exe commandline program. However, it happens if I run any command. It really appears to be due to the UseShellExecute property. I guarantee I am not working on the same image from different threads.

Basically, the program loads multi-paged tiff files for splitting and merging operations. When I load the tiffs, each page is extracted from the original and saved in a temp folder. Then I use the backgroundworker to generate preview images for each page. This takes around half a second per page, so a 60 page tif can take some time to load. While loading the preview images, you can do merging and splitting. I only operate on the original image at this time.

Can anyone shed some light on UseShellExecute? I'd like to be able to read StandardError. I just don't see how this property can effect code running on a separate thread.

Thanks for your time.