转换一个字节数组PNG / JPG [英] Converting a byte array to PNG/JPG
本文介绍了转换一个字节数组PNG / JPG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前工作的,需要一个护垫字节数组的高性能转换到一个PNG或JPEG的应用程序。图像格式并不重要,只要你将它的快。
I am currently working on an application that requires high-performance conversion of an unpadded byte array to either a PNG or JPEG. The image format doesn't matter, just as long as it's fast.
我已经试过了.NET库和性能是非常糟糕的。任何人都可以推荐一个好免费软件库呢?
I have tried the .NET libraries and the performance is very bad. Can anyone recommend a good freeware library for this?
编辑:字节[]是一个8位灰度位图
the byte[] is an 8bit grayscale bitmap
推荐答案
您应该能够做这样的事:
You should be able to do something like this:
byte[] bitmap = GetYourImage();
using(Image image = Image.FromStream(new MemoryStream(bitmap)))
{
image.Save("output.jpg", ImageFormat.Jpeg); // Or Png
}
希望这有助于。
这篇关于转换一个字节数组PNG / JPG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文