python-pillow / python-pillow/Pillow
FitsImagePlugin does not support RICE_1 compression
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.8k
- Forks
- 2.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 89
Description
What did you do?
Tried using pillow for opening/handling a .fits file.
The header in my fits file has two parts and the its structure is like this:
BITPIX = 16 / number of bits per data pixel
NAXIS = 0 / number of data axes
EXTEND = T / FITS dataset may contain extensions
COMMENT FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H
END
XTENSION= 'BINTABLE' / binary table extension
BITPIX = 8 / 8-bit bytes
NAXIS = 2 / 2-dimensional binary table
...
END
The fits file that I use comes from satellite observation data. Here's an example fits file that comes from the same satellite with the same header structure.
I'm not sure whether this kind of header agrees the fits format standard, so I checked the fit format document. In section 3.3.1, it says
The last header block must contain the END keyword, which marks the logical end of the header.
It means that the fits file I use agrees with the fits file standard.
I have just checked PR #5405 , it seems that when reading the fits file from disk, the code break at the first END.
What did you expect to happen?
Not receiving a "ValueError: No image datar" while using Image.open. Expected to load the fits image data.
What actually happened?
The Image.open code returns: ValueError: No image data
What are your OS, Python and Pillow versions?
- OS: Linux
- Python: 3.9
- Pillow: 10.1.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at FitsImagePlugin and reproduce the failure by opening the linked sample FITS file with Image.open. Inspect how the first END header and RICE_1 compression are handled; done means the sample file opens without ValueError: No image data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100