Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from astropy.io import fits
- from auto_stretch.stretch import Stretch # https://github.com/LCOGT/auto_stretch/
- from PIL import Image
- fits_img = fits.open("result_.fit")
- data = fits_img[0].data
- stretched = Stretch().stretch(data)
- stretched = np.transpose(stretched , (1, 2, 0))
- stretched = ((stretched - stretched.min()) / (stretched.max() - stretched.min()) * 255).astype(np.uint8)
- pil_image = Image.fromarray(stretched)
- pil_image.save("result_stretched.tif", format="TIFF")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement