GNU Astronomy Utilities ConvertType input and output

At most four input files (one for each color channel for formats that allow it) are allowed in ConvertType. The first input dataset can either be a file, or come from Standard input (see Standard input and Recognized file formats).

The order of multiple input files is important. After reading the input file(s) the number of color channels in all the inputs will be used to define which color space to use for the outputs and how each color channel is interpreted: 1 (for grayscale), 3 (for RGB) and 4 (for CMYK) input channels. For more on pixel color channels, see Pixel colors. Depending on the format of the input(s), the number of input files can differ.

For example, if you plan to build an RGB PDF and your three channels are in the first HDU of r.fits, g.fits and b.fits, then you can simply call MakeProfiles like this:

$ astconvertt r.fits g.fits b.fits -g1 --output=rgb.pdf

However, if the three color channels are in three extensions (assuming the HDUs are respectively named R, G and B) of a single file (assuming channels.fits), you should run it like this:

$ astconvertt channels.fits -hR -hG -hB --output=rgb.pdf

On the other hand, if the channels are already in a multi-channel format (like JPEG), you can simply provide that file:

$ astconvertt image.jpg --output=rgb.pdf

If multiple channels are given as input, and the output format does not support multiple color channels (for example, FITS), ConvertType will put the channels in different HDUs, like the example below. After running the astfits command, if your JPEG file was not grayscale (single channel), you will see multiple HDUs in channels.fits.

$ astconvertt image.jpg --output=channels.fits
$ astfits channels.fits

As shown above, the output’s file format will be interpreted from the name given to the --output option (as a common option to all Gnuastro programs, for the description of --output, see Input/Output options). It can either be given on the command-line or in any of the configuration files (see Configuration files). When the output suffix is not recognized, it will default to plain text format, see Recognized file formats.

If there is one input dataset (color channel) the output will be gray-scale. When three input datasets (color channels) are given, they are respectively considered to be the red, green and blue color channels. Finally, if there are four color channels they will be cyan, magenta, yellow and black (CMYK colors).

The value to --output (or -o) can be either a full file name or just the suffix of the desired output format. In the former case (full name), it will be directly used for the output’s file name. In the latter case, the name of the output file will be set based on the automatic output guidelines, see Automatic output. Note that the suffix name can optionally start with a . (dot), so for example, --output=.jpg and --output=jpg are equivalent. See Recognized file formats.

The relevant options for input/output formats are described below:


Input HDU name or counter (counting from 0) for each input FITS file. If the same HDU should be used from all the FITS files, you can use the --globalhdu option described below. In ConvertType, it is possible to call the HDU option multiple times for the different input FITS or TIFF files in the same order that they are called on the command-line. Note that in the TIFF standard, one ‘directory’ (similar to a FITS HDU) may contain multiple color channels (for example, when the image is in RGB).

Except for the fact that multiple calls are possible, this option is identical to the common --hdu in Input/Output options. The number of calls to this option cannot be less than the number of input FITS or TIFF files, but if there are more, the extra HDUs will be ignored, note that they will be read in the order described in Configuration file precedence.

Unlike CFITSIO, libtiff (which is used to read TIFF files) only recognizes numbers (counting from zero, similar to CFITSIO) for ‘directory’ identification. Hence the concept of names is not defined for the directories and the values to this option for TIFF files must be numbers.


Use the value given to this option (a HDU name or a counter, starting from 0) for the HDU identifier of all the input FITS files. This is useful when all the inputs are distributed in different files, but have the same HDU in those files.

-w FLT

The width of the output in centimeters. This is only relevant for those formats that accept such a width as metadata (not FITS or plain-text for example), see Recognized file formats. For most digital purposes, the number of pixels is far more important than the value to this parameter because you can adjust the absolute width (in inches or centimeters) in your document preparation program.


Use Hexadecimal encoding in creating EPS output. By default the ASCII85 encoding is used which provides a much better compression ratio. When converted to PDF (or included in TeX or LaTeX which is finally saved as a PDF file), an efficient binary encoding is used which is far more efficient than both of them. The choice of EPS encoding will thus have no effect on the final PDF.

So if you want to transfer your EPS files (for example, if you want to submit your paper to arXiv or journals in PostScript), their storage might become important if you have large images or lots of small ones. By default ASCII85 encoding is used which offers a much better compression ratio (nearly 40 percent) compared to Hexadecimal encoding.

-u INT

The quality (compression) of the output JPEG file with values from 0 to 100 (inclusive). For other formats the value to this option is ignored. Note that only in gray-scale (when one input color channel is given) will this actually be the exact quality (each pixel will correspond to one input value). If it is in color mode, some degradation will occur. While the JPEG standard does support loss-less graphics, it is not commonly supported.