Windows Mobile 上的 JPEG 加载

发布于 2024-07-18 15:39:58 字数 757 浏览 6 评论 0原文

我正在寻找一种更快的方法来将 JPEG(或 PNG?)加载到 Windows Mobile 上的 .NET 位图中...

我刚刚尝试过加载 JPEG、PNG 和 GIF:

for (int i = 0; i < files.Length; i++)
{
    int tries = 10;
    while (--tries > 0)
    {
        int size = (int)new FileInfo(files[i]).Length;
        FileStream fs = new FileStream(files[i], FileMode.Open);
        sw.Reset();
        sw.Start();
        Bitmap b2 = new Bitmap(fs);
        sw.Stop();
        Debug.WriteLine(files[i] + "\n\t" + 
            sw.ElapsedMilliseconds.ToString());
        fs.Close();
    }
}
JPEG (medium)        100ms~
JPEG (medium prog.)  200ms~
PNG  (64 colour)      50ms~
GIF  (32 dith)        50ms~

托管 Bitmap 类可能不是最快 - 但有人确切知道吗?

I'm looking for a faster way to load JPEG (or PNG?) into a .NET Bitmap on Windows Mobile...

I've just had a go at loading JPEG, PNG and GIF:

for (int i = 0; i < files.Length; i++)
{
    int tries = 10;
    while (--tries > 0)
    {
        int size = (int)new FileInfo(files[i]).Length;
        FileStream fs = new FileStream(files[i], FileMode.Open);
        sw.Reset();
        sw.Start();
        Bitmap b2 = new Bitmap(fs);
        sw.Stop();
        Debug.WriteLine(files[i] + "\n\t" + 
            sw.ElapsedMilliseconds.ToString());
        fs.Close();
    }
}
JPEG (medium)        100ms~
JPEG (medium prog.)  200ms~
PNG  (64 colour)      50ms~
GIF  (32 dith)        50ms~

The managed Bitmap class probably isn't the fastest - but does anyone know for sure?

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

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

发布评论

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

评论(1

请叫√我孤独 2024-07-25 15:39:58

确实没有别的事了。 您可以使用诸如成像 API 之类的东西来加载它,但是 1)我怀疑它是否真的会更快,2)然后您就无法将它用作托管图像或位图,因此它几乎没有用(加上我/我很确定这就是框架正在做的事情)。

这些图像有多大(分辨率和颜色深度)? 这将是一个重要的因素是加载需要多长时间。

There really isn't anything else. You could use something like the Imaging APIs to load it, but 1) I doubt it will be really any faster and 2) you then couldn't use it as a Managed Image or Bitmap, so it would be pretty useless (plus I/m pretty sure that's what the framework is doing anyway).

How big (resolution and color depth) are these images? That's going to be the large factor is how long it takes to load.

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