无损图像压缩 [英] Lossless image compression

查看:82
本文介绍了无损图像压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用无损压缩技术压缩图像,然后将其上传到云端。所以,我需要C#.Net代码用于此目的。

解决方案

您好,


您可以使用Image来自System.Drawing。 PNG具有无损压缩功能,因此您可以使用Image.FromFile(filePath)加载图像;使用(var image = Image.FromFile(" c) :\\path\\file.bmp"))
using(MemoryStream ms = new MemoryStream())
{
image.Save(ms,ImageFormat.Png);
//上传图片
}


I Want to compress image using lossless compression technique and then upload it to cloud. So, i need the C# .Net code for this purpose.

解决方案

Hi,

You can use Image from System.Drawing. PNG has a lossless compression, so you can load your image with Image.FromFile(filePath); 

            using (var image = Image.FromFile("c:\\path\\file.bmp"))
                using (MemoryStream ms = new MemoryStream())
                {
                    image.Save(ms, ImageFormat.Png);
                    // Upload image here
                }


这篇关于无损图像压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆