[fitsbits] conversion of jpeg to fits

LC's NoSpam Newsreading account nospam at mi.iasf.cnr.it
Tue Sep 18 05:56:35 EDT 2007


On Mon, 17 Sep 2007, Sreenath K R wrote:

> I have jpeg image and I would like to convert it into fits format. 

The GIMP should have a plugin to convert jpeg to FITS (at least my 
version has). Note however that such a conversion has several intrinsic 
(philosophical, not technical) problems.

A FITS image is essentially a data array, an xy matrix of measurements, 
which contains z values in some physical units (can be the readout of a 
CCD camera, or the number of photons in the pixel or anything else). The 
pixels are generally pixels on a detector, and are associated to sky 
positions via the WCS keywords in the FITS header. But nobody forbids to 
use a FITS file to keep chisquare on z, hydrogen column density and 
spectral slope on x,y or anything else.

A jpeg image is a picture or a plot. 
It occurred to me to have jpeg images of small "thumbnails" of sky 
areas, which I wanted to use for overlays.

These pictures had a frame with axes, tics and labels all around, and 
contained inside the frame a sky image with some fixed colour scaling.

What I had to do was cropping the image to cut out the outside of the 
frame, and then output the inside of the frame in a "basic" FITS file. 
The GIMP can do that. But then I need to manually add a WCS to the FITS 
header with some external FITS utility, in order to be able to overlay 
sky objects.

To me the idea of supplying thumbnails as jpeg and not FITS seems a 
brain-damaged idea, but sometimes there are data right policies ...

> Also I would like to know generally what is the format of the data of 
> any image that is given as input for making fits format.

You should carefully read the FITS standard. FITS images can contain 
data in integer and floating point form with a variety of bits/pixel 
(see BITPIX). So provided you take care of the conversion to the 
endianness required by FITS you can use almost any numeric data array as 
source ... provided you write the header accordingly.


-- 
----------------------------------------------------------------------
nospam at mi.iasf.cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.



More information about the fitsbits mailing list