fits_to_png

gammapy.image.fits_to_png(infile, outfile, draw, dpi=100)[source]

Plot FITS image in PNG format.

For the default dpi=100 a 1:1 copy of the pixels in the FITS image and the PNG image is achieved, i.e. they have exactly the same size.

Parameters:

infile : str

Input FITS file name

outfile : str

Output PNG file name

draw : callable

Callback function draw(figure) where figure is an FITSFigure.

dpi : int

Resolution

Examples

>>> def draw(figure):
...     x, y, width, height = 42, 0, 3, 2
...     figure.recenter(x, y, width, height)
...     figure.show_grayscale()
>>> from gammapy.image import fits_to_png
>>> fits_to_png('image.fits', 'image.png', draw)