久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將位圖保存為 32bpp 不保持透明度

Saving Bitmap as 32bpp doesn#39;t keep transparency(將位圖保存為 32bpp 不保持透明度)
本文介紹了將位圖保存為 32bpp 不保持透明度的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

using (var bmp = new Bitmap(image.Width, image.Height, PixelFormat.Format32bppArgb))
using (var g = Graphics.FromImage(bmp))
{
    g.Clear(Color.Transparent);
    g.DrawImage(image, 0, 0);
    bmp.Save("image.bmp", ImageFormat.Bmp);
}

問題應該很清楚:為什么保存到 BMP 會破壞 黑色 的透明度,而保存到 PNG 嗎?

The question should be clear: why saving to BMP trashes transparency to black, while saving to PNG keeps it ?

澄清一下:圖像采用 Format8bppIndexed 格式,其調色板確實包含透明顏色(例如,它可以正確繪制到表單/圖片框上)

Just to clarify: image is in Format8bppIndexed format and its palette does contain transparent colors (e.g. it draws correctly onto form/picturebox)

我的錯,Bitmap.Save()實際上以Format32bppRgb格式保存BMP,即使位圖格式是Format32bppArgb.

My bad, Bitmap.Save() actually saves BMP in Format32bppRgb format, even though the bitmap format is Format32bppArgb.

推薦答案

這是因為 bmp 文件格式默認不支持透明度,而 png 文件格式支持.

It's because by default the bmp file format doesn't support transparency while the png file format does.

如果你想要透明度,你將不得不使用 png.壓縮算法是無損的,因此您不會在圖像中出現偽影.該文件也將占用更少的磁盤空間.

If you want transparency you are going to have to use png. The compression algorithms are lossless so you're not going to get artefacts in your image. The file will take up less space on disk too.

這篇關于將位圖保存為 32bpp 不保持透明度的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Right-click on a Listbox in a Silverlight 4 app(右鍵單擊 Silverlight 4 應用程序中的列表框)
WPF c# webbrowser scrolls over top menu(WPF c# webbrowser 在頂部菜單上滾動)
C# Console app - How do I make an interactive menu?(C# 控制臺應用程序 - 如何制作交互式菜單?)
How to avoid duplicate form creation in .NET Windows Forms?(如何避免在 .NET Windows Forms 中創建重復的表單?)
UI Automation Control Desktop Application and Click on Menu Strip(UI自動化控制桌面應用程序并單擊菜單條)
Removing thin border around the menuitems(刪除菜單項周圍的細邊框)
主站蜘蛛池模板: 中文字幕亚洲天堂 | 色婷婷香蕉在线一区二区 | 欧美色图在线视频 | 青草福利视频 | 欧美一级黄| 日韩一区中文字幕 | av一区二区三区 | 天天干天天操天天摸 | 日韩第一区 | 日韩成人精品一区二区 | 国产成人网 | 97国产精品 | 国产精品国产三级国产专区52 | 中文字幕一区二区三区在线观看 | www.狠狠操.com| 午夜精品福利视频 | 亚洲美女在线视频 | 国产区在线视频 | 91婷婷| www亚洲天堂 | 午夜久久久久久 | 欧美一级在线 | 国产精品久久久一区二区三区 | 欧美理论片在线观看 | 欧美精品入口蜜桃 | 黄色片免费网站 | 福利视频在线 | 欧美一区二区视频在线观看 | av黄色大片 | 日韩在线中文字幕 | 色一情一乱一乱一区91av | 欧美色婷婷 | 在线不卡一区二区 | 欧美成人高清 | 日韩成人精品 | 一级做a爱片性色毛片 | 成人在线视频免费观看 | 日韩高清在线播放 | 国产精品自拍第一页 | 久热精品在线 | 天天干少妇|