Log in

View Full Version here: : .FIT to .AVI or .GIF ?


rogerg
13-06-2006, 11:18 AM
Does anyone know how to easily convert .FIT files to an animated GIF or an AVI ?

I've done it in the past by manually saving the FIT files at .GIF files then creating an animated GIF from those. This was OK where I only had 10-20 frames. From last night's Pluto occulation I want to include 859 .FIT files in the animation, so I need to automate the process somehow.

If they were any other file type I'd setup an action in photoshop which might do it, or at least make it a lot quicker. But I can't read .FIT in photoshop.

CCDSoft will save one at a time for me, but that would be slow.

Ideas?

Thanks,
Roger.

janoskiss
13-06-2006, 11:40 AM
I use ImageMagick for that sort of thing - a real swiss army knife of image processing. It has a command line interface which makes doing repetitive tasks and handling arbitrarily large numbers of files easy. For what you want you would do something like:

convert -delay 10 *.fit animation.gif

I use it under Unix/Linux, but there are DOS and Windows versions out as well. It's free GPL software. :)

http://www.imagemagick.org

rogerg
13-06-2006, 10:06 PM
Thanks for the suggestion.... seems perfect, except I can't get results from it. It grinds away at 1.25GB memory usage for a while then savest he GIF.

The GIF does contain the correct number of frames, bu they're all black :shrug:

The brightness ranges of the images should be fine, as when I open them up in CCDSoft they're showing ok. But I wonder if the GIF conversion uses the full brightness range, hence my faint image (max of 1,600ADU out of 65,000ish) isn't showing anything when converted.

I'll keep plugging away at it on another night, when I have ADSL2 back, on dialup right now so not bothering to track down the help manual for ImageMagick.

Roger.

janoskiss
14-06-2006, 09:34 AM
Hmmm. Not sure about that one. I have never seen it do that. If you convert a single frame to gif, i.e.,

convert pic.fit pic.gif

does that look black too? If so you may want to convert from fit to some other format (tif or png say) and then to gif animation. Also, I would not be surprised if the Windows version has some issues, as this is Unix software ported to Windows afaik.

rogerg
15-06-2006, 11:17 PM
OK, as a programmer of many years (with limited linux experience) I am ashamed to admit this thing's got me beat. I guess I just don't have the patients I used to for command line operations :-)

I have tried converting to GIF and JPG, this shows the problem. It is the brightness. It seems that when it's converting from FIT to other formats it's using the whole brightness range, not the shaddow & hilight values the CCDSoft loads from the file. If I brighten up the GIF/JPG the stars are visible in a horrible pixilated form.

So, it seems I need a way to convert it to GIF, preserving the shaddow/hilight values. Hmm.. Suggestions? :)

See attached files. Zip file containts a FIT file.

Roger.

janoskiss
16-06-2006, 12:44 AM
I see the problem. The FIT file has no scaling information, just a bunch of numbers, where the user or external software has to decide which number is black and which is white. F in FIT stands for Flexible. There is obviously a price to pay for this flexibility.

I had a look at your image. You just need to tweak the levels till you are happy with the result.

You can use the -modulate and -level options. Something like this:

convert -modulate 10000 -level 30%,70%,0.65 test.fit test.png

will produce the image I've attached (in jpeg format) from your fit file.

-modulate changes the brightness (not really needed because -level could do it but the numbers in this fit file are so small that it's easier to amplify first). Here I've used the value 10000, which means 10000% or 100 times brighter. Then -level does exactly the same thing as Levels in Photoshop or the Gimp. You have black level, white level (both between 0 and 100%), and gamma (typically between 0.5 and 2).

So just play around with a typical image and decide on a set of -modulate and -level parameters, and then apply the same to the whole stack of FITS files to produce the animation, e.g.:

convert -delay 10 -modulate 10000 -level 30%,70%,0.65 *.fit animation.gif

rogerg
16-06-2006, 10:36 AM
:thumbsup:

Will give it a try tonight when I'm home.

Roger.