将字节转换为透明图像

时间:2019-03-31 20:11:24

标签: c# arrays image-processing transparency

我已经遇到了用sqlMemoryStream插入透明图像的问题,并用File.ReadAllBytes(filePath)修复了问题,MemoryStream不能正确放置透明区域,并且现在,为了获得正确的图像,我不知道该怎么办。我从堆栈溢出和其他网站搜索帖子,有关于将透明图像插入sql的帖子,但对此一无所知

 using (Image image = Image.FromStream(new MemoryStream(bitmap)))
 {
     image.Save(Address, ImageFormat.Jpeg);
 }

有人知道如何将字节转换为透明图像吗? tnx

1 个答案:

答案 0 :(得分:0)

您正在将图像保存为JPEG文件。 JPEG图像不支持透明性。您可以使用PNG或GIF图像。它们都支持透明性。

相关问题