如何正确管理图片预览

发布于 2025-01-03 09:34:02 字数 486 浏览 0 评论 0原文

我正在开发一个能够显示文件预览的 C# 软件。基本上,左侧有一棵树显示磁盘文件系统条目,右侧有一个面板将显示树中所选文件的预览,在一个可调整大小的面板中包含一个停靠的PictureBox 。最初我只显示图像文件的预览。

这个软件是为游戏开发者设计的,所以我需要支持所有的图像格式,我将使用伟大的 ImageMagick 库用于此目的。关键是有些图像文件可能很大,非常大,所以我有几个关于性能和内存消耗的问题。

  1. 我需要线程加载图片吗?总是,或者仅当图片很大时?
  2. 如果我直接在 Picturebox 中加载图片,这将是正确的,或者我应该计算较小尺寸的图像(如缩略图或类似的东西),将其保存到磁盘,然后显示它?
  3. 有人知道我在哪里可以下载大图片文件来测试我的预览与非常大的文件。

I'm developing a C# software that is able to show previews for files. Basically, there is a tree at the left that shows the disk filesystem entries, and a panel on the right that will show a preview of files selected in the tree, in a resizable panel that contains a docked PictureBox. Initially I only show preview for image files.

This software is designed for game developers, so I need to support all the image formats, I will use the great ImageMagick library for this purpose. The key is that some image files could be big, very big so, I have several questions, about performance and memory consumption.

  1. Do I need to thread the load of the picture? Always, or only if the picture is very big?
  2. Would be a correct if I load the picture directly in the Picturebox, or should I calculate a smaller size image (like a thumbnail or something similar), save it to disk, and then, show it?
  3. Someone knows where can I download big picture files to test my preview with really very large files.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉宸 2025-01-10 09:34:02
  1. 我总是把这样的作品串联起来,试图决定什么是大的没有什么意义;对于正在谈论的图像,我认为大多数就足够了,在错误的条件下(计算机将资源花费在其他进程上,而不仅仅是您的进程上),它可能会导致 UI 线程中明显的暂停。

  2. 在不了解更多信息的情况下,我只会在执行基本操作时测试您的实现并做出判断。还有用户所需的质量和桌面分辨率的问题 - 所以也许这应该以某种方式进行配置。

  3. 在我看来,没有比 PolyCount 更好的地方了,具体请查看以下论坛:
    http://www.polycount.com/forum/forumdisplay.php?f=42 &
    http://www.polycount.com/forum/forumdisplay.php?f=60

  1. Imo always thread a work like this, there is little point in trying to decide what is big; for images that of are talking about I would of thought most would be enough that under the wrong conditions (computer is spending resources on other processes, not just yours) it could cause a perceivable pause in the UI thread.

  2. Without knowing more, I would just test your implementation when it does the basic stuff and make a judgement call. There is also the question of required quality and desktop resolution of the user - so perhaps this should be configurable in some way.

  3. Imo there could be no better place than PolyCount, specifically look in these forums:
    http://www.polycount.com/forum/forumdisplay.php?f=42 &
    http://www.polycount.com/forum/forumdisplay.php?f=60

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文