ProcessStartInfo.UseShellExecute = false 如何导致 FreeImageNet 在单独的线程上出现奇怪的行为?

发布于 2024-07-30 01:01:06 字数 1035 浏览 0 评论 0原文

我正在后台工作程序中运行 进程 来调整大小图片。 如果我在进程的 startinfo,如果我使用 FreeImageNet UI 线程上的库。 奇怪的行为是,当我通过 CloseMultiBitmap() 关闭新图像时,该方法似乎有效,但它只留下 FICACHE 和 FISPAOL 文件,而不是最终图像。 如果我设置 UseShellExecute = true 一切都会按预期工作。

后台工作进程调用ImageMagick 的convert.exe 命令行程序。 但是,如果我运行任何命令,就会发生这种情况。 这似乎确实是由于 UseShellExecute 属性造成的。 我保证我不会从不同的线程处理同一个图像。

基本上,该程序加载多页 t​​iff 文件以进行拆分和合并操作。 当我加载 tiff 时,每个页面都会从原始页面中提取并保存在临时文件夹中。 然后我使用后台工作程序为每个页面生成预览图像。 每页大约需要半秒,因此 60 页的 tif 可能需要一些时间才能加载。 加载预览图像时,您可以进行合并和分割。 我此时只对原始图像进行操作。

任何人都可以阐明 UseShellExecute 吗? 我希望能够阅读 StandardError。 我只是不明白这个属性如何影响在单独线程上运行的代码。

谢谢你的时间。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文