HOW TO:將 BMP 影像轉換為 PNG 影像

更新:2007 年 11 月

您通常會想要將影像檔案格式轉換為其他格式。您可以呼叫 Image 類別的 Save 方法,並且指定所需之影像檔案格式的 ImageFormat,輕鬆地完成這項轉換。

範例

下列範例會從型別載入 BMP 影像,並將影像儲存為 PNG 格式。

Private Sub SaveBmpAsPNG()
    Dim bmp1 As New Bitmap(GetType(Button), "Button.bmp")
    bmp1.Save("c:\button.png", ImageFormat.Png)

End Sub
private void SaveBmpAsPNG()
{
    Bitmap bmp1 = new Bitmap(typeof(Button), "Button.bmp");
    bmp1.Save(@"c:\button.png", ImageFormat.Png);
}

編譯程式碼

這項範例需要:

  • Windows Form 應用程式。

請參閱

工作

HOW TO:列出已安裝的編碼器

概念

點陣圖類型

其他資源

使用 Managed GDI+ 中的影像編碼器和解碼器