Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-04

FITS export of bitmaps (flexible image transport system)

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd

Before I move on to the next project and forget this thing again I want to donate a little FITS library to the community. Currently it can only create FITS files and not read them but this should not be too difficult to add. I did not have any priority for this use case, I create images and need to export them as valid FITS.

http://pastebin.com/zbATCW3b

It might still contain a few bugs, its only 3 days old but it does work and exported truecolor or grayscale bitmaps can be read by IRIS and this is basically all I need. It can be used/extended to contain/export any arbitrary data but currently only methods for automatically converting an 8*3 TBitmap into a NAXIS=3 (color) or NAXIS=2 (gray) with BITPIX=8 are implemented and working. I am too lazy to open a sourceforge project now just for this little file but I thought others might have some use for this library too, maybe somebody else is interested to put some more work into it. This is the only Pascal implementtion of FITS I am currently aware of.

Usage:

var
  Bitmap: TBitmap;
  Fits: TFitsObect;
begin
  ...
  Fits := TFitsObject.CreateFromBitmap(Bitmap);
  Fits.SaveToFile(FileName);
  Fits.Free;

or before saving do things like

  Fits.Primary.HeaderBlock.AddCard(TFitsHeaderCard('exposure', 200));
  Fits.Primary.HeaderBlock.AddCard(TFitsHeaderCard('gain', 5));
  Fits.Primary.HeaderBlock.AddCard(TFitsHeaderCard('foo', 'bar baz whatever'));
  Fits.SaveToFile(FileName);