Author Topic: Fits (.fit) file extension?  (Read 365 times)

alightner

  • Newbie
  • *
  • Posts: 8
Fits (.fit) file extension?
« on: March 06, 2019, 10:24:57 PM »
First thank you for this AMAZING tool!  I've used it in combination with perl scripts to organize nearly 2 decades worth of photographs that had various naming conventions over the years.  Now I have it renaming files as I offload cards so I never get that disorganized again :)

I've just started getting into astrophotography and the cameras use fits files (more specifically .fit)
https://en.wikipedia.org/wiki/FITS
I have no idea what would be involved with adding support for fit files, but am curious if that has been considered.

I can manually try to be more careful with filenames in the software programs used to capture these files, but when my settings are incorrect it sure is nice to have exiftool as a backup.
Thanks again!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: Fits (.fit) file extension?
« Reply #1 on: March 07, 2019, 07:08:38 AM »
Adding support for reading FITS files looks easy.  I'll see what I can do.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: Fits (.fit) file extension?
« Reply #2 on: March 07, 2019, 12:07:01 PM »
I have just released ExifTool 11.31 with the ability to read FITS files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

alightner

  • Newbie
  • *
  • Posts: 8
Re: Fits (.fit) file extension?
« Reply #3 on: March 07, 2019, 01:23:07 PM »
OMG - you are fast!  I was trying to reply earlier to tell you that your consideration of the request made my day and wondering what I could do to help out.  I was going to attach a sample fit file, but during the process I had a hard drive go down and you beat me to it :)

I will download and test tonight, but that is AMAZING - thank you. 

I've written OSS code before and know that requests get balanced with my available time so I never imagined you'd do it in a day... THANK YOU!!! 
You're a rock star :)

alightner

  • Newbie
  • *
  • Posts: 8
Re: Fits (.fit) file extension?
« Reply #4 on: March 07, 2019, 07:06:04 PM »
Downloaded and tested exiftool executable first, then installed the updated exiftool in perl as well - it all works great!
Thanks again!

Now off to update all of my perl scripts to check fits vs raw/jpeg and handle the new/different fields appropriately :)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: Fits (.fit) file extension?
« Reply #5 on: March 07, 2019, 09:57:01 PM »
Great!  Thanks for the feedback.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: Fits (.fit) file extension?
« Reply #6 on: March 08, 2019, 11:56:50 AM »
I was trying to figure out how some of the FITS parameters related to the usual tags extracted for images.  It seems that NAXIS1 (or ZNAXIS1) is typically the image width, and NAXIS2 (or ZNAXIS2) is the height.  What would you think about me changing the names of these to ImageWidth and ImageHeight?  These are tags that are universal across most image formats, and it could be useful to have these available for FITS images.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

alightner

  • Newbie
  • *
  • Posts: 8
Re: Fits (.fit) file extension?
« Reply #7 on: March 08, 2019, 10:59:44 PM »
That was the case for my files and I was reading those two variables in and treating them as if they were my width and height in the perl script along side the width and height from my old canon raw files.  Converting those simplifies my logic, so I’m all for it.  Don’t know if other user might have a different view.

This line is what I’m unsure of in the definition:

Flexible Image Transport System (FITS) is an open standard[3] defining a digital file format useful for storage, transmission and processing of data: formatted as N-dimensional arrays (for example a 2D image), or tables.

Is it just that 2d images work out to use those as width and height?  Or maybe you add those two values as width and height but also allow them to read out with their original names so people with more than 2d can read them however it makes sense in their use?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: Fits (.fit) file extension?
« Reply #8 on: March 08, 2019, 11:05:28 PM »
Thanks for the feedback.  I could add a Composite tag derived from these if necessary.  I'll maybe download some more samples to see if this is generally true.  But this wording in the specification worries me:

NAXIS1 keyword. The value field shall contain a non-negative integer, giving the number of ASCII characters in each row of the table. This includes all the characters in the defined fields plus any characters that are not included in any field.

NAXIS2 keyword. The value field shall contain a non-negative integer, giving the number of rows in the table.


So NAXIS1 is probably not the image width if the table is ASCII (how many ASCII characters does it take to specify a pixel?).  But NAXIS2 is likely the height.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

alightner

  • Newbie
  • *
  • Posts: 8
Re: Fits (.fit) file extension?
« Reply #9 on: March 09, 2019, 10:09:02 AM »
If you're looking for help in getting more sample data... there's a very helpful astrophotography forum called cloudy nights.  I will post out there to see if I can get some users with more experience than myself to comment on these questions and possibly help provide sample files.  I've only just begun with this new hobby after shooting nature photography in daylight for 15 years.
Thanks again,
Liz

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: Fits (.fit) file extension?
« Reply #10 on: March 09, 2019, 10:33:33 AM »
Maybe you could ask if the image dimensions are usually given by NAXIS1,NAXIS2?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

alightner

  • Newbie
  • *
  • Posts: 8
Re: Fits (.fit) file extension?
« Reply #11 on: March 09, 2019, 11:15:20 AM »

alightner

  • Newbie
  • *
  • Posts: 8
Re: Fits (.fit) file extension?
« Reply #12 on: March 09, 2019, 01:36:15 PM »
Quote
It needs to be noted that FITS is a container, and each data block can contain ASCII or binary data. The verbiage Phil shared refers to ASCII blocks, however for astronomical image data, it should be binary data (int or real), and in those cases, I am pretty sure that NAXIS1 is the column count and NAXIS2 is the row count. Fields shouldn't apply to binary image data, so I don't think you would have to worry about field vs. non-field data.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: Fits (.fit) file extension?
« Reply #13 on: March 12, 2019, 11:13:17 AM »
I've done a bit more reading about this.

Currently ExifTool is reading only the primary header of a FITS file.  Any BINARY extension comes later in the file (after the primary data array), and is not read by ExifTool.  So for these types of files the extracted values of NAXIS1/2 would not relate to the image size.

So I think I'll leave ExifTool as it is for now.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

alightner

  • Newbie
  • *
  • Posts: 8
Re: Fits (.fit) file extension?
« Reply #14 on: March 12, 2019, 07:58:14 PM »
Fine with me, I can work around it.  Thanks!