Bug 8170 - Digital raw images mime types
Summary: Digital raw images mime types
Status: RESOLVED FIXED
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: freedesktop.org.xml (show other bugs)
Version: unspecified
Hardware: All All
: high normal
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Keywords:
: 4117 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-09-07 06:01 UTC by Udi Fuchs
Modified: 2007-03-08 07:12 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
mime type for digital cameras' raw images (5.42 KB, text/xml)
2006-09-07 06:05 UTC, Udi Fuchs
Details
mime types for digital cameras' raw images (5.71 KB, text/xml)
2006-10-25 15:59 UTC, Udi Fuchs
Details
shared-mime-info-raw.patch (6.60 KB, patch)
2006-10-30 06:22 UTC, Stanislav Brabec
Details | Splinter Review
ufraw-mime.xml (6.09 KB, text/xml)
2006-10-30 15:44 UTC, Udi Fuchs
Details
/home/udif/sf/ufraw/shared-mime-info-ufraw.patch (6.73 KB, patch)
2006-10-30 15:46 UTC, Udi Fuchs
Details | Splinter Review
shared-mime-info-ufraw.patch (7.44 KB, patch)
2007-02-19 07:13 UTC, Stanislav Brabec
Details | Splinter Review

Description Udi Fuchs 2006-09-07 06:01:52 UTC
I noticed that recently some support for digital cameras raw images was added.
The problem with the new mime types is that some of these format are based on
the TIFF format and therefore match the image/tiff magic check. This causes
applications like nautilus to wrongly treat the file as a TIFF file, at least
when trying to generate thumbnails.

The solution is to define these mime types as <sub-class-of type="image/tiff"/>.

Attached are the mime definitions from UFRaw's development code. It has the
following features:

1. Adds sub-class-of image/tiff where necessary.

2. For images which are not sub-class-of image/tiff, use magic when possible
(based on http://www.chauveau-central.net/rawthumb/)

2. All raw formats are sub-class-of image/x-dcraw. This way applications can
have only one mime-type in the desktop entry and they do not need to be modified
every time a new raw image type is introduced.

3. Adds a few more image types: panasonic-raw, pentax-pef, sigma-x3f, sony-srf,
sony-sr2, sony-arw.

4. Adds an application/x-ufraw mime type for ufraw ID files.

If you want to see these mime-types in action you can check out ufraw's cvs
(http://ufraw.sourceforge.net/). The cvs version includes the mime types,
desktop entries and schemas for thumbnails. You only need to remember to use
'./configure --enable-mime' since it is not enabled by default.

I had issues with Canon CRW/CR2 images because they already had mime types
defined by freedesktop.org. For CRW images I solved the problem by temporarily
setting the magic priority to 60.

I guess that if you are using the cvs version of freedesktop.org you will also
have issues with all the new mime-types defined there.

I could supply several dozen sample raw file upon request (but they are BIG).

Udi
Comment 1 Udi Fuchs 2006-09-07 06:05:21 UTC
Created attachment 6864 [details]
mime type for digital cameras' raw images
Comment 2 Udi Fuchs 2006-10-25 15:59:33 UTC
Created attachment 7518 [details]
mime types for digital cameras' raw images

Added a DNG mime type.
Comment 3 Stanislav Brabec 2006-10-26 08:40:45 UTC
I guess, that application/x-ufraw is application specific file and maybe should
be packaged with ufraw package, not with freedesktop.org.xml.

image/x-dcraw seems to be superseded by particular MIME types and does not have
real reason to exist in this form (description does not contain any other magic
or suffixes). Maybe it can be handled better in future as a virtual MIME type:
http://lists.freedesktop.org/archives/xdg/2006-October/008666.html
or you can use not yet separately handled suffix list from
http://ftp.penguin.cz/pub/users/utx/gnome-dcraw/dcraw.xml
Comment 4 Udi Fuchs 2006-10-26 17:05:11 UTC
'application/x-ufraw' is for ufraw ID files. An ID file contains data for
converting a specific raw image. 'ufraw IDFILE.ufraw' will convert the image
according to the data in the ID file. I'm not sure if this should have been
'application/x-ufraw' or 'image/x-ufraw'. Anyway, if you think it does not
belong in freedesktop.org I don't have a problem with that.

I made all the raw formats <sub-class-of type="image/x-dcraw"/>. This is then
used in the desktop file. For example in ufraw:

MimeType=application/x-ufraw;image/x-dcraw

This way there is no need to update the desktop file each time a new raw type is
supported. This could be used by any software based on dcraw, like ufraw,
digikam and dcraw itself. I didn't check if the 'image/x-dcraw' mime type itself
is necessary. It just seemed strange to have sub-class-of a type that is not
defined.

You might want to test how these mime types behave with UFRaw-0.10, which was
just release. Just don't forget to './configure --enable-mime' and read the
README. Thumbnail are generated in nautilus and double clicking opens the image
in ufraw.

Sample raw files (and a UFRaw ID file) can be found at:
http://ufraw.sourceforge.net/mime/
I'll probably remove this link in a few weeks so keep the copy you download.

Udi
Comment 5 Stanislav Brabec 2006-10-27 07:30:10 UTC
About application/x-ufraw: I am not sure, what is the freedesktop.org consensus
for application-specific data files. But having it in freedesktop.org does not
allow future major format changes.

About image/x-dcraw: I understand your intention. But I think, that having a
MIME type for "all MIME types supported by application xxx" in freedesktop.org
is not the right way, becausev it makes assumption, that dcraw version >= foo is
installed altogether with this version of shared-mime-info.

"This way there is no need to update the desktop file each time a new raw type
is supported." Yes, it is true, but this way there is a need to update
freedesktop.org whenever dcraw will start to support new raw type.

This is exactly the purpose, for which I proposed "virtual MIME types", which
may appear in one of the next Shared MIME Info specifications, and will allow to
specify the list of MIME types actually supported by some subsystem. For my
original proposal, see
http://lists.freedesktop.org/archives/xdg/2005-November/007544.html (final
implementation may differ).
Comment 6 Udi Fuchs 2006-10-29 08:35:11 UTC
About application/x-ufraw: The basic format is xml with .ufraw file type. The
files starts with <UFRaw Version='7'>, where the version number can and will
change, but future versions of ufraw should be able to read files from older
versions. Is this format definition stable enough for freedesktop.org?

The only change that I think should be considered, before adding it, would be
whether it should be called 'application/x-ufraw' or 'image/x-ufraw'.

About image/x-dcraw: Instead of viewing it as 'all mime types supported by the
application dcraw', it should be considered as 'all know mime types for Digital
Camera RAW files'.

Notice that there is no correlation between the information in the mime type and
the list of raw formats supported by a specific version of dcraw or any other
software. For example, the Nikon D80 is supported only from dcraw 8.36, but its
mime type is image/x-nikon-nef, just like all Nikon digital cameras ever
manufactured.

> "This way there is no need to update the desktop file each time a new raw type
> is supported." Yes, it is true, but this way there is a need to update
> freedesktop.org whenever dcraw will start to support new raw type.

We need to update freedesktop.org when a camera manufacture comes out with a new
format. This is not different from the current implementation in
freedesktop.org. In any case this should not happen to often. I think that the
only new format from the last year is image/x-sony-arw.

It is good to know about "virtual MIME types". It could be very useful for the
ufraw-gimp plug-in. I don't see how it relates to the issue at hand (notice that
you yourself are using image/x-dcraw in the example).
Comment 7 Stanislav Brabec 2006-10-30 06:00:21 UTC
application/x-ufraw: You do not include magic, so it's your (and freedesktop.org
maintainer's decision). Looking at application/* in freedesktop.org, many single
application specific formats are included, some are not. I guess that it can be
included, too.

image/x-dcraw: Yes, as 'all known mime types for Digital Camera RAW files' it is
acceptable. But in this case image/x-dcraw should cover other RAW file types
without dedicated MIME type:

    <glob pattern="*.bay" />
    <glob pattern="*.bmq" />
    <glob pattern="*.cs1" />
    <glob pattern="*.dc2" />
    <glob pattern="*.fff" />
    <glob pattern="*.k25" />
    <glob pattern="*.mos" />
    <glob pattern="*.pef" />
    <glob pattern="*.rdc" />
    <glob pattern="*.srf" />
    <glob pattern="*.x3f" />
Comment 8 Stanislav Brabec 2006-10-30 06:22:57 UTC
Created attachment 7586 [details] [review]
shared-mime-info-raw.patch

Proposed patch based on your list with added suffixes to image/x-dcraw (list
from previous comment minus all raw MIME types handled specially).
Comment 9 Udi Fuchs 2006-10-30 15:44:24 UTC
Created attachment 7602 [details]
ufraw-mime.xml

You are missing erf, hdr, mdc, pxn and sti file types (list taken from Dave
Coffin's rawphoto.c).

For *.k25 I found a sample raw and it is also sub-class-of image/tiff. I added
it, but I'm not sure it is of much interest. This format was used in the Kodak
D25 camera that had resolution of 501 by 242. If freedesktop.org wants to
support all file format, it should be added. If there is screening for really
obscure file types it can be ignored.

*.hdr is used by Leaf Cameras and is a sub-class-of image/tiff. The link at
http://filext.com/detaillist.php?extdetail=hdr&Search=Search seems to indicate
that this definition is not unique so I'm not adding it at the moment.

There are 2 more raw file types *.jpg, *.tif. I think they are used by some old
Canon and Kodak cameras. For these two cases it is obvious that adding them
would cause more harm than good unless we have some very strong magic.

To summaries, we are missing the following types (in addition to the *.hdr,
*.jpg, *.tif discussed above):
    <glob pattern="*.bay" />
    <glob pattern="*.bmq" />
    <glob pattern="*.cs1" />
    <glob pattern="*.dc2" />
    <glob pattern="*.erf" />
    <glob pattern="*.fff" />
    <glob pattern="*.mdc" />
    <glob pattern="*.pxn" />
    <glob pattern="*.mos" />
    <glob pattern="*.rdc" />
    <glob pattern="*.sti" />
I'm guessing that they are all from outdated cameras. I suggest not adding them
to the mime database without magic. I'll try to find some samples from these
cameras. Meanwhile, it would be nice if what we have so far would be added to
shared-mime-info.

Attached is a new version of ufraw-mime.xml with the image/x-kodak-k25. I added
magic to image/x-fuji-raf, so now all the mime types are either sub-class-of
image/tiff or have magic. I also changed the priority of image/x-canon-crw from
60 to 50. It was 60 to override the old mime type in freedesktop.org, which is
no longer relevant.
Comment 10 Udi Fuchs 2006-10-30 15:46:42 UTC
Created attachment 7603 [details] [review]
/home/udif/sf/ufraw/shared-mime-info-ufraw.patch

Attached is a patch for shared-mime-info with the latest version of
ufraw-mime.xml.
Comment 11 Stanislav Brabec 2007-02-19 07:13:20 UTC
Created attachment 8776 [details] [review]
shared-mime-info-ufraw.patch

Previous patch updated for shared-mime-info-0.20.

Can you apply it, please?
Comment 12 Frederic Crozat 2007-03-02 08:26:13 UTC
*** Bug 4117 has been marked as a duplicate of this bug. ***
Comment 13 Frederic Crozat 2007-03-02 08:29:53 UTC
I just did some cleaning on old patched.

Patch 8776 is safe to commit.
Comment 14 Christian - Manny Calavera - Neumair 2007-03-08 07:12:14 UTC
Thanks for your hard work! Committed, closing.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.