Support FITS images with GZIP_1 compression by radarhere · Pull Request #7894 · python-pillow/Pillow

Helps #7771. The issue requests support for RICE_1 compression. This is a stepping stone, providing support for something other than uncompressed data.

https://fits.gsfc.nasa.gov/fits_primer.html is a helpful source for the specification. It explains that FITS images are comprised of header and data units. After the primary SIMPLE header, an image XTENSION may follow. Each header unit "is a multiple of 2880 bytes long".

https://heasarc.gsfc.nasa.gov/fitsio/c/c_user/node41.html states that "GZIP_1 compresses the array of image pixel value normally with the GZIP algorithm". After decompressing the data, I found that it was padded to 4 bytes and flipped vertically.

The test files are sample images from https://fits.gsfc.nasa.gov/registry/tilecompression.html