# Saving a Python plot as a FITS file

**URL:** https://community.openastronomy.org/t/saving-a-python-plot-as-a-fits-file/371
**Category:** Astropy
**Tags:** astropy, fits
**Created:** [June 16, 2022, 5:19pm UTC](https://community.openastronomy.org/t/saving-a-python-plot-as-a-fits-file/371 "2022-06-16T17:19:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![astrogalactic](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@astrogalactic](https://community.openastronomy.org/u/astrogalactic)
#### Post date: [June 16, 2022, 5:19pm UTC](https://community.openastronomy.org/t/saving-a-python-plot-as-a-fits-file/371/1 "2022-06-16T17:19:40Z")

</div>

Good afternoon, for one of my projects, I am trying to save a Python plot (using matplotlib and numpy) as a FITS file. However, when I right-click on the image to try and save it, the only option available is to store data as a .PNG file. Is there anyway to save this image as a FITS file? I tried searching online and found that one could do so if you are simply editing an existing FITS file.

---

<div class="post-metadata">

### Author: ![nabobalis](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/nabobalis/32/14_2.png) [@nabobalis](https://community.openastronomy.org/u/nabobalis)
#### Post date: [June 16, 2022, 5:50pm UTC](https://community.openastronomy.org/t/saving-a-python-plot-as-a-fits-file/371/2 "2022-06-16T17:50:53Z")

</div>

From what I understand the FITS standard is not designed to save out images from a plot. If you want to store the array data that forms the main part of your image, you can save that as a FITS file. See [FITS File Handling (astropy.io.fits) — Astropy v5.1](https://docs.astropy.org/en/stable/io/fits/index.html#creating-a-new-fits-file)

Can I ask why you want an image as a FITS file?
