Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET: what image file types can Image.FromFile() handle?

Tags:

.net

image

I use Image.FromFile() to read image files uploaded by a user. For the 'choose file' dialog box, what file extensions can I allow?

Thanks!

like image 317
Jon Onstott Avatar asked May 11 '12 02:05

Jon Onstott


People also ask

What file types are accepted for images in HTML?

Formats like WebP and AVIF are recommended as they perform much better than PNG, JPEG, GIF for both still and animated images. WebP is widely supported while AVIF lacks support in Safari. SVG remains the recommended format for images that must be drawn accurately at different sizes.

What are the four main image formats that you can use for images on the Web?

There are four main image file types that are most widely used online: JPG, PNG, GIF and SVG. This article will look at what each of the different file types are designed for and tell you when you should use them.

What are two correct file formats of web ready images?

There are three file formats for graphics used on the web: JPG, GIF, and PNG. Each of these file formats are designed with a specific purpose in mind, so it is important to understand the differences when we use them in our websites.


1 Answers

From microsoft's documentation: http://msdn.microsoft.com/en-us/library/stf701f5.aspx

  • BMP
  • GIF
  • JPEG
  • PNG
  • TIFF

I believe this should be the filter string:

Bitmap images|*.bmp|GIF images|*.gif|JPEG images|*.jpg; *.jpeg; *.jpe; *.jif; *.jfif; *.jfi|PNG images|*.png|TIFF images|*.tiff; *.tif|All files|*.*

Note that I allowed for additional valid extensions for JPEG and TIFF images.

like image 54
Nick Babcock Avatar answered Oct 14 '22 17:10

Nick Babcock