Repository navigation
[io] Scale an image that Pillow reads in mode I to 8 bits like a 16-bit one - #2240
Open
RavSinghChandan wants to merge 1 commit into
Open
RavSinghChandan wants to merge 1 commit into
RavSinghChandan wants to merge 1 commit into
Conversation
…g_as_numpy read_img_as_numpy decodes with OpenCV and used Pillow only for images with transparency, so an image that OpenCV cannot decode raised "unable to read file." while read_img_as_tensor, which uses Pillow, read it. Of the 786 images in Pillow's own test images that Pillow opens (up to 20 megapixels), 95 failed in read_img_as_numpy and Pillow reads 55 of them: TGA, SGI, PSD, TIFF with LZMA compression or with 12-bit and 16-bit samples, BMP and GIF files, among others. The other 40 are truncated or damaged files that Pillow cannot read either. When OpenCV returns nothing the image is now decoded with Pillow, the way the images with transparency are, and a file that Pillow cannot read still raises the same ValueError.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
read_img_as_numpy decodes with OpenCV and used Pillow only for images with transparency, so an image OpenCV cannot decode raised "unable to read file." while read_img_as_tensor, which uses Pillow, read it. Of the 786 images in Pillow's own test images that Pillow opens (up to 20 megapixels), 95 failed in read_img_as_numpy; Pillow reads 55 of them (TGA, SGI, PSD, TIFF with LZMA compression or 12-bit and 16-bit samples, BMP and GIF files, and others). The other 40 are truncated or damaged files that Pillow cannot read either.
When OpenCV returns nothing, the image is now decoded with Pillow, the way the images with transparency are, and a file Pillow cannot read raises the same ValueError. Test added for TGA, SGI and PCX (formats OpenCV never decodes), from a path and from bytes, in RGB and BGR, with output_size, and a truncated file (fails on main).