Radiane MIME types (was: HDR extension in rad, trad)

Randolph,

The official mime types are assined by the IANA:
http://www.iana.org/assignments/media-types/

Getting .hdr accepted by IANA would mean that eventually all other
mime assignment, e.g.
for the various LINUX desktops:
http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html
will pick it up

I started a thread here:
http://luminance.londonmet.ac.uk/radiance_mailinglists/dev/2006-November/000761.html
but it didn't lead anywhere.

When I said I was not sufficiently confident about the file format,
then this is what I meant:
(see http://radsite.lbl.gov/radiance/refer/filefmts.pdf)

HDR comes in two flavours:
- RGBE
- XYZE

Each of those two flavours has three sub-flavours:
- non-rle
- rle
- mixed

Greg (http://luminance.londonmet.ac.uk/radiance_mailinglists/dev/2006-November/000766.html):
-----------8<--------------

Both, RGBE and XYZE come in flat and in RLE flavours. However, the
official file specs only mention two FORMAT= string, i.e. 32-
bit_rle_rgbe
and 32-bit_rle_xyze. How does this work?

I decided not to sub-type based on the presence or absence of run-
length encoding. Since the reader routines identify RLE on a per
scanline basis (and in fact there can be a mix of RLE and
uncompressed scanlines), there seemed no need for a separate format
specifier.

The MIME specs have the notion of subclasses. So would RGBE and
XYZE be
subclasses of RADIANCE HDR?

Again, I wouldn't bother to distinguish these within MIME. It would
be like distinguishing between different classes of TIFF. Any
software that opens an RGBE file will also open an XYZE file, even if
it won't display the colors correctly.
-----------8<--------------

So there you go...

I've started working on a mime XML file following the freedesktop.org
style. This is to make my yearly chore of rolling LEARNIX somewhat
easier. It's not well tested yet, but here is the first draft. The bit
with the extensions seems to work, but I haven't tried yet what
happens when the extension is removed (mime magick).

Ignore all non-HDR stuff. I just thought I might as well leave it in,
in the hope of getting some comments.

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">

  <mime-type type="image/x-hdr">
    <comment xml:lang="en">HDR image</comment>
  <alias type="image/x-radiance"/>
  <alias type="image/x-rgbe"/>
    <magic priority="50">
      <match type="string" value="#?RADIANCE" offset="0"/>
      <match type="string" value="FORMAT=32-bit_rle_rgbe" offset="0:500"/>
    </magic>
    <glob pattern="*.hdr"/>
    <glob pattern="*.unf"/>
    <glob pattern="*.xyze"/>
    <glob pattern="*.rgbe"/>
  </mime-type>

  <mime-type type="model/x-radiance-control">
  <sub-class-of type="text/plain"/>
    <comment xml:lang="en">Radiance input</comment>
    <glob pattern="*.rif"/>
  </mime-type>

  <mime-type type="application/x-radiance-octree">
    <comment xml:lang="en">Radiance octree</comment>
    <magic priority="50">
      <match type="string" value="#?RADIANCE" offset="0"/>
      <match type="string" value="FORMAT=Radiance_octree" offset="0:500"/>
    </magic>
    <glob pattern="*.oct"/>
  </mime-type>

  <mime-type type="application/x-radiance-ambient-cache">
    <comment xml:lang="en">Radiance ambient cache</comment>
    <glob pattern="*.amb"/>
  </mime-type>

  <mime-type type="model/x-radiance-holodeck-control">
  <sub-class-of type="text/plain"/>
    <comment xml:lang="en">Radiance holodeck input</comment>
    <glob pattern="*.hif"/>
  </mime-type>

  <mime-type type="application/x-radiance-holodeck">
    <comment xml:lang="en">Radiance holodeck</comment>
    <glob pattern="*.hdk"/>
  </mime-type>

  <mime-type type="model/x-radiance-geometry">
  <sub-class-of type="text/plain"/>
    <comment xml:lang="en">Radiance geometry</comment>
    <glob pattern="*.rad"/>
    <glob pattern="*.norm"/>
  </mime-type>

  <mime-type type="model/x-radiance-triangle-mesh">
    <comment xml:lang="en">Radiance triangle mesh</comment>
    <glob pattern="*.rtm"/>
  </mime-type>

  <mime-type type="model/x-radiance-material">
  <sub-class-of type="text/plain"/>
    <comment xml:lang="en">Radiance material</comment>
    <glob pattern="*.mat"/>
  </mime-type>

  <mime-type type="model/x-radiance-view">
  <sub-class-of type="text/plain"/>
    <comment xml:lang="en">Radiance view</comment>
    <glob pattern="*.vf"/>
  </mime-type>

  <mime-type type="model/x-radiance-cal">
  <sub-class-of type="text/plain"/>
    <comment xml:lang="en">Radiance cal</comment>
    <glob pattern="*.cal"/>
  </mime-type>

  <mime-type type="model/x-radiance-bgraph">
  <sub-class-of type="text/plain"/>
    <comment xml:lang="en">Radiance bgraph</comment>
    <glob pattern="*.bgraph"/>
  </mime-type>

  <mime-type type="model/x-radiance-options">
  <sub-class-of type="text/plain"/>
    <comment xml:lang="en">Radiance options</comment>
    <glob pattern="*.opt"/>
  </mime-type>

</mime-info>

Axel