我编写了一种降低颜色深度(GIF 转换)的方法,并将位图的分辨率设置为 600 像素。
颜色深度转换工作正常,但分辨率设置不起作用。
<script runat="server" language="C#">
public static void Convert(Bitmap oldbmp, String path)
{
System.Drawing.Bitmap bm8Bit;
using (MemoryStream ms = new MemoryStream())
{
oldbmp.Save(ms, ImageFormat.Gif);
ms.Position = 0;
bm8Bit = (System.Drawing.Bitmap) System.Drawing.Image.FromStream(ms);
bm8Bit.SetResolution(600, 600);
bm8Bit.Save(path, System.Drawing.Imaging.ImageFormat.Bmp);
return;
}
}
</script>