Is there a generic mime-type for all image files? Normally there isn't, but there are a couple of exceptions documented later in this answer. You need a Mime Type in order to know how to process a file (without having to read the file header).
I know that I can use the specific mime-types as listed for example here, or a generic mime-type for any file like application/octet-stream
, but is there a generic mime-type for all image files?
(I want to edit a .desktop
file in Linux Mint KDE to create an 'Action' context-menu entry in Dolphin File Manager that would be shown only for image files.)
2 Answers
Is there a generic mime-type for all image files?
Normally there isn't, but there are a couple of exceptions documented later in this answer.
You need a Mime Type in order to know how to process a file (without having to read the file header).
Notes:
Not all image files have a header that identifies their type.
SVG files, for example, are just XML files. So without the correct mimetype or extension there would be no way to correctly identify the type of the file.
Mime Types are specified as Content-Type/subtype
There isn't a Mime Type
image/generic
(See 'Further reading' below for the full list of IANA registered image subtypes).
Does it mean that there is a mime-type for multiple image files?
There is no singleContent-Type/subtype
that covers multiple image formats.
In theory you could use an unknown Subtype such as image/xyz
but W3C says explicitely:
'a Content-Type of image/xyz
is enough to tell a user agent that the data is an image, even if the user agent has no knowledge of the specific image format xyz
... 'such an action might be reasonable for unrecognized subtypes of text, but not for unrecognized subtypes of image or audio'
In general, the top-level Content-Type is used to declare the general type of data, while the subtype specifies a specific format for that type of data.
Thus, a Content-Type of 'image/xyz' is enough to tell a user agent that the data is an image, even if the user agent has no knowledge of the specific image format 'xyz'.
Such information can be used, for example, to decide whether or not to show a user the raw data from an unrecognized subtype -- such an action might be reasonable for unrecognized subtypes of text, but not for unrecognized subtypes of image or audio.
For this reason, registered subtypes of audio, image, text, and video, should not contain embedded information that is really of a different type. Such compound types should be represented using the 'multipart' or 'application' types.
Source W3C - The Content-Type Header Field
Mime Type For Rar Files Free
Can I use a wildcard like image/*
for my special case?
so that it can be used for my purpose without the need of specifying the singular file extensions/mimes?
Yes. As you have pointed out a wildcard can be used when specifying the 'Desktop Entry' for the the KDE and GNOME desktop environments.
However, please note that Key=MimeType
is deprecated as there is a new standard for this.
Type=MimeType
is deprecated as there is a new standard for this now, see the Shared MIME-info Database specification for more information. In consequence the Keys Patterns (various file name extensions associated with the MIME type) and DefaultApp (the default application associated with this MIME type) are also deprecated.
Source Desktop Entry Specification
You can also use wildcards for mime types in IIS, but is advised to not do this:
You can also configure IIS to serve undefined file types by adding a wildcard character (*) MIME type.
Do not use wildcard MIME-types on production servers. Doing so can result in IIS serving unrecognized files and displaying sensitive information to users.
Wildcard MIME-types are intended for testing purposes or in scenarios where Internet Server API (ISAPI) filters have been developed specifically to handle these wildcard scenarios, for example, a custom authentication ISAPI.
Source Creating Global MIME Types
Further reading
- IANA - Registered Media Types - Image (Image Content-Type and subtypes)
According to this SO-Answer there is no generic MIME-Type. The problem is that the MIME-Type is allways composed of a Type, a Subtype and a optional Parameter: Type/Subtype; Parameter
(see here). You only want to use the type, but by definition a subtype is required and there is no generic subtype. A list of all image types can be found here.
Mime Type For Rar
Mime Type For Rar File
A multipurpose internet mail extension, or MIME type, is an internet standard that describes the contents of internet files based on their natures and formats. This cataloging helps the browser open the file with the appropriate extension or plugin. Although the term includes the word “mail,” it is used for web pages, too.
MIME types contain two parts: a type and a sub-type.
- The type describes the categorization of MIME types that are linked to each other.
- In contrast, a subtype is unique to a specific file type that is part of the type.
Here is the MIME type for HTML:
MIME types are defined in HTML by the
What Are Mime Types
Distinguishing Among MIME Types
Following is a list of most MIME types, with their file extensions and the applications that use them. Many computers use file extensions to help identify file types. So, if you have a file with an odd extension on your website, you can look up the MIME type in this list.
Some types are prefixed with X, and some are prefixed with VND. These prefixes, respectively, refer to sub-types not listed with the Internet Assigned Numbers Authority or values specific to a vendor.