![](/img/trans.png)
[英]How can I generate a downloadable c# class from within an ASP.NET MVC website?
[英]how to make image as downloadable from database in asp.net,C#
我将图像以二进制格式保存到数据库中,而在检索时,我正在将该二进制格式转换为图像文件并显示。
byte[] picbin = (byte[])(binary data in datbase);
ImageConverter ic = new ImageConverter();
System.Drawing.Image img = (System.Drawing.Image)ic.ConvertFrom(picbin);`
并通过提供一些名称将img-变量保存到某个文件夹中。 但是现在我需要能够以任何一种格式为该特定图像的用户提供“可下载的选项”,以便用户可以对其进行验证,以便实现该目标的方法是什么。
要将图像转换为其他格式:
// Save the image in JPEG format.
img.Save(@"C:\test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
// Save the image in GIF format.
img.Save(@"C:\test.gif", System.Drawing.Imaging.ImageFormat.Gif);
// Save the image in PNG format.
img.Save(@"C:\test.png", System.Drawing.Imaging.ImageFormat.Png);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.