.NET image.Save, in what format is the file saved?

When I use, for example, in C #, an image class that implements the Save method, in what format will the file be? I suppose this will be what I enter in order to maintain the dialogue, but what if I introduce some kind of meaningless extension?

+4
source share
2 answers

If you do not specify a format, the image will be saved in the format returned by Image.RawFormat Property . This means that it does not matter what you type in the file name. The RawFormat property returns the format returned by the built-in GdipGetImageRawFormat function, which should correspond to the current image format.

+3
source

EDIT: BMP is the standard format.

PNG seems to be the default format. The Save () method provides overrides for specifying different formats.

Image.Save("c:\\myimage.gif", System.Drawing.Imaging.ImageFormat.Gif); 

The file extension does not affect the image format used.

http://msdn.microsoft.com/en-us/library/ktx83wah.aspx

+6
source

Source: https://habr.com/ru/post/1339613/


All Articles