question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Save cropped fits to file?

See original GitHub issue

Say I have the following code:

from astropy.io import fits
from photutils.utils import cutout_footprint

hdulist = fits.open('myimage.fits')
hdu_data = hdulist[0].data

# Some center and box
xc, yc, xbox, ybox = 1000., 1000., 500., 700.
hdu_crop = cutout_footprint(hdu_data, (xc, yc), (ybox, xbox))[0]

How can I save the cropped image to a new fits file and conserve the header information?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

How do I crop a fits.gz file and then view the ... - Stack Overflow
This FITS file has the image data in the primary HDU just like the input. import numpy as np from astropy.io import fits...
Read more >
How can I crop a fits file and get correct WCS header info ...
Just choose the rectangle tool, drag, and then choose Image->Crop. It doesn't save the WCS, though apparently that is on the development roadmap ......
Read more >
Using Windows Paint to Save, Crop and Manipulate Graphics ...
Cropping a picture If you want to crop your picture, click on dashed box symbol. Then click and drag your cursor to form...
Read more >
Crop a picture to fit in a shape - Microsoft Support
Click Picture Tools > Format, and in the Size group, click the arrow under Crop. Crop button found on the Picture Tools Format...
Read more >
How to save a Cropped Image - Capture One
Rotate the crop to suit by grabbing just outside the corners of the crop frame (the cursor will change to a curved arrow)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found