shared-mime-info: image/x-fits -> image/fits

Alexey Shuvaev shuvaev at physik.uni-wuerzburg.de
Tue Feb 17 03:41:34 PST 2009


On Tue, Feb 17, 2009 at 10:51:33AM +0100, Vincent Untz wrote:
> Alexey asked to be cc'ed, so doing this ;-)
> 
Thanks!

> Vincent
> 
> Le mardi 17 février 2009, à 10:38 +0100, David Faure a écrit :
> > On Thursday 12 February 2009, Alexey Shuvaev wrote:
> > > Hello all!
> > > 
> > > The long history short: FITS image mime type is officially registered
> > > since 2005. So it is named image/fits and application/fits now.
> > > The history of acception:
> > > 	http://www.ucolick.org/~sla/fits/mime/
> > > RFC 4047:
> > > 	http://www.rfc-editor.org/rfc/rfc4047.txt
> > 
> > Indeed, http://www.iana.org/assignments/media-types/image/ knows about image/fits.
> > 
Yes, and http://www.iana.org/assignments/media-types/application/ knows
about application/fits
As I have mentioned it is not so important but if we are at FITS mime
types it may be reasonable to add this type (application/fits) too.
See attached patch.
It is an old patch against 1.401 of freedesktop.org.xml.in so hunks
about image/fits should be almost completely removed.
Here I tried to add application/fits and make image/fits subclass of it.
The problem is how to differentiate between them (they have identical
signatures).
In a nutshell, each FITS file starts with the following 3 lines:
SIMPLE  =                  T
BITPIX  =                  8
NAXIS   =                  3

Actually these are not 'classical lines' (no newline at the end) but
80-bytes keyword-value entries padded with spaces :)
BITPIX may have other values (16, 32, 64, -32, -64 IIRC).
The difference between application/fits and image/fits (in its simplest case)
is that image is allowed to have NAXIS = [1,2,3] while application has
no restrictions. So if some guru here can code this into
freedesktop.org.xml.in, that would be nice.

> > > As of image/fits, I think it should be fixed.
> > 
> > Done.
> > 
Super!

> > 2009-02-17  David Faure  <faure at kde.org>
> > 
> > 	* freedesktop.org.xml.in: Rename image/x-fits to image/fits
> > 	(IANA-registered name), and add image/x-fits as alias
> > 	* tests/list: Update testcase accordingly
> > 
> > However for you to benefit from this fix, a new shared-mime-info
> > release has to be made, which is not in my hands.
> > 
Ok, it is not so critical. It is imortant to know that it will be fixed
in the next release of shared-mime-info.

Small note to Michael (developer of FITS gdk-pixbuf-loader).
The file in the test directory of shared-mime-info (test.fit)
was rejected by the loader:
> gdk-pixbuf-csource test.fit
failed to load "test.fit": Failed to load image 'test.fit': Unable to read non-trivial 3-dimensional FITS image

As suggested in RFC 4047 it might be reasonable to handle such files too.
Don't know if it possible to create animated pixbuf but showing the first
plane in such a file is OK too.

Thanks to all!
Alexey.
-------------- next part --------------
diff -rup shared-mime-info.orig/freedesktop.org.xml.in shared-mime-info/freedesktop.org.xml.in
--- shared-mime-info.orig/freedesktop.org.xml.in	2009-02-16 22:47:09.000000000 +0100
+++ shared-mime-info/freedesktop.org.xml.in	2009-02-16 23:49:51.000000000 +0100
@@ -3611,15 +3611,27 @@ command to generate the output files.
     <glob pattern="*.epsi"/>
     <glob pattern="*.epsf"/>
   </mime-type>
-  <mime-type type="image/x-fits">
+  <mime-type type="application/fits">
     <_comment>FITS document</_comment>
     <acronym>FITS</acronym>
     <expanded-acronym>Flexible Image Transport System</expanded-acronym>
     <magic priority="50">
-      <match type="string" value="SIMPLE  =" offset="0"/>
+      <match type="string" value="SIMPLE  =                    T" offset="0"/>
     </magic>
     <glob pattern="*.fits"/>
   </mime-type>
+  <mime-type type="image/fits">
+    <_comment>FITS document</_comment>
+    <acronym>FITS</acronym>
+    <expanded-acronym>Flexible Image Transport System</expanded-acronym>
+    <generic-icon name="image-x-generic"/>
+    <sub-class-of type="application/fits"/>
+    <magic priority="55">
+      <match type="string" value="SIMPLE  =                    T" offset="0"/>
+    </magic>
+    <glob pattern="*.fits"/>
+    <alias type="image/x-fits"/>
+  </mime-type>
   <mime-type type="image/x-fpx">
     <_comment>FPX image</_comment>
     <acronym>FPX</acronym>
diff -rup shared-mime-info.orig/tests/list shared-mime-info/tests/list
--- shared-mime-info.orig/tests/list	2009-02-16 22:51:56.000000000 +0100
+++ shared-mime-info/tests/list	2009-02-16 23:14:13.000000000 +0100
@@ -14,7 +14,7 @@ test.cel image/x-cel xxx 
 test.dcm application/dicom
 test.eps image/x-eps
 GammaChart.exr image/x-exr
-test.fit image/x-fits x
+test.fit image/fits x
 test.fli video/x-flic ox
 test.gif image/gif
 test.ico image/x-ico


More information about the xdg mailing list