Added FITS reading, deprecate FitsStubImagePlugin#6056
Added FITS reading, deprecate FitsStubImagePlugin#6056mergify[bot] merged 6 commits intopython-pillow:mainfrom
Conversation
| if _handler is None or not hasattr("_handler", "save"): | ||
| raise OSError("FITS save handler not installed") | ||
| _handler.save(im, fp, filename) | ||
| offset = math.ceil(self.fp.tell() / 2880) * 2880 |
There was a problem hiding this comment.
The documentation mentioned that the offset for the image data was a multiple of 2880.
https://fits.gsfc.nasa.gov/fits_primer.html
Each header or data unit is a multiple of 2880 bytes long. If necessary, the header or data unit is padded out to the required length with ASCII blanks or NULLs depending on the type of unit.
The data unit, if present, immediately follows the last 2880-byte block in the header unit.
hugovk
left a comment
There was a problem hiding this comment.
Let's also add to release notes.
Do we need to worry about the removed FITSStubImageFile class?
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
|
Ok, I've figured out how to deprecate FitsStubImagePlugin.
Since this PR is only adding support for reading, you might wonder what someone is supposed to do if they were saving images using FitsStubImagePlugin. Well, it turns out, that's not actually a concern - there is a bug (#6071) that means they can't have been saving images using FitsStubImagePlugin. |
hugovk
left a comment
There was a problem hiding this comment.
Looks good, couple of little docs autolink nits.
|
The links to FitsImagePlugin are now there - but I discovered I couldn't link to FitsStubImagePlugin, because I removed it from the documentation to prevent new users from finding it. |
hugovk
left a comment
There was a problem hiding this comment.
Makes sense, let's just code format it then.
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Resolves #4054, adding reading of FITS files by upgrading the FITS plugin from a StubImageFile to an ImageFile.
I have updated the hopper FITS test image. The original was similar, but not equal, to
hopper("L"), so I generated this new file with Pillow and ImageMagick. The updated file is still L mode, like the original.