C# ImageFormat to string

前端 未结 4 1640
灰色年华
灰色年华 2021-02-07 23:24

How can I obtain human readable string(i.e. image format itself) from System.Drawing.ImageFormat object?

I mean if I have ImageF

4条回答
  •  终归单人心
    2021-02-07 23:42

    Use the ImageFormatConverter class from the System.Drawing namespace:

    this.imageInfoLabel.Text = 
        new ImageFormatConverter().ConvertToString(this.Image.RawFormat);
    

    For a PNG image it returns Png, and so on.

提交回复
热议问题