Windows Mobile 上的 JPEG 加载
我正在寻找一种更快的方法来将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确实没有别的事了。 您可以使用诸如成像 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.