[fitsbits] Storing PDF and other graphics binary files in FITS {External}

jaffe jaffe at strw.leidenuniv.nl
Thu Mar 26 10:13:16 EDT 2026


I solved my own problem within the existing FITS standards, at least 
within the python matplotlib astropy environment.  I generate plots 
using the matplotlib pdf backend, and convert them to low-level binary 
using the python io.IOByte package.  I then put them into a FITS binary 
table as a 1-row, 1-column table containing a single large byte array.

When I want to display the plot I reverse the process reading out the 
binary table, then send the binary .pdf data to a viewer either as a 
pipe or by storing to disk and spawning the viewer.

Presumably equivalent methods can be developed in other programming 
environments.

Walter

-------- Original Message --------
Subject: Storing PDF and other graphics binary files in FITS
Date: 2026-03-15 16:25
 From: jaffe <jaffe at mail.strw.leidenuniv.nl>
To: Fitsbits <fitsbits at listmgr.nrao.edu>

For an interferometric application I am storing the binary data in the 
so-called OI-FITS convention of FITS.  But on the side I am generating 
rather complicated graphics files for my users, in this case in PDF.  I 
would like to store the .pdf file as a table in the same FITS file.  Is 
there a conventional way of doing this?  I could create a 1 row binary 
table with the entire PDF file as the single column, but this could be 
several megabytes and might bother some reading or writing routines.

Is there any need to create a "GRAPHICS" extension to FITS?

Walter



More information about the fitsbits mailing list