GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix imread issues mentioned on matplotlib-devel by cgohlke · Pull Request #616 · matplotlib/matplotlib

Conversation

@cgohlke

@cgohlke cgohlke commented Dec 9, 2011

Copy link
Copy Markdown
Contributor

http://sourceforge.net/mailarchive/message.php?msg_id=28520067

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cgohlke added 3 commits December 9, 2011 13:37
@cgohlke
Don't flip PIL image
9a9813f
@cgohlke
Fix conversion of PIL 16 bit grayscale images to 8 bit
b1a0a1a
@cgohlke
Add detection of file extension for file-like objects
98d706b
@cgohlke

cgohlke commented Dec 9, 2011

Copy link
Copy Markdown
Contributor Author

Other possible options for handling 16 bit images:

  1. just divide by 256 before casting to uint8, possibly loosing dynamic range (10 and 12 bit images are common).
  2. allow pil_to_array() to return uint16 arrays. The docstring says that uint8 is returned.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mdboom

mdboom commented Dec 9, 2011

Copy link
Copy Markdown
Member

I like the idea of pil_to_array returning a 16 bit array when the input image is 16-bit. It allows the caller to deal with downsampling to 8-bit in the most appropriate way. We can update the docstring to indicate that the dtype of the output depends on the input file or some such. I think it's reasonable to make small backward-incompatible changes like this on master (just add to the changelog). While we're at it, can we add a test for this? Showing that a 16-bit input image is correctly returned as a 16-bit array?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cgohlke added 5 commits December 9, 2011 20:39
@cgohlke
Allow pil_to_array to return arrays with dtypes other than uint8
8408cb3
@cgohlke
No more need to flip PIL images in imshow
e87bc08
@cgohlke
Return native byte order uint16
463a3b5
@cgohlke
Test reading uint16 grayscale image with PIL
de5ed7c
@cgohlke
Add uint16 image
64d3264
@cgohlke cgohlke mentioned this pull request Dec 13, 2011
Correctly load 16-bit images. #622
Closed
mdboom
mdboom reviewed Dec 14, 2011
View reviewed changes
Comment thread lib/matplotlib/tests/test_image.py

@mdboom mdboom Dec 14, 2011

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be turned into an image comparison test to ensure that the fields of the image are correctly read in, endianness works etc. Or if that's not practical, maybe assert about a few of the data values?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mdboom

mdboom commented Dec 14, 2011

Copy link
Copy Markdown
Member

I have one small note about testing. This doesn't (I believe) change the fact that PNG images read through the _png extension (i.e. not through PIL) are still converted to 8-bit. We should fix that as well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jdh2358

jdh2358 commented Feb 26, 2012

Copy link
Copy Markdown
Collaborator

This PR looks useful but discussion seems to have died down. I'd like to get this in the bugfix release. @cgohlke , any chance you could change the src to v1.1.x rather than master. Do you have any feedback from @mdboom comments?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cgohlke

cgohlke commented Mar 1, 2012

Copy link
Copy Markdown
Contributor Author

I don't think all of these changes can go into v1.1.x. Not flipping PIL images or allowing 16 bit images might break existing applications. The _png extension should be fixed in another PR. It is currently broken in master (test_png .py fails).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Jun 1, 2012
RGB image is flipped a different way depending on whether it is PNG or JPG #101
Closed
_png extension loads 16-bit PNGs as 8-bit #915
Merged
@mdboom

mdboom commented Jun 1, 2012

Copy link
Copy Markdown
Member

I agree this shouldn't be on 1.1.x, but it should get merged into master.

I've added an issue #915 to track adding 16-bit support to the _png extension.

As far as I can tell, the test_png.py failure is currently obsolete -- it is passing on master now.

I think the following would make this mergeable:

  1. Add a few asserts to the unit test to ensure the data is read correctly. I think assert that "sum" of the pixels is the correct value would be adequate to ensure there were no endianness problems, etc.

  2. Rebase this on current master

  3. Make sure the regression tests still pass.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mdboom

mdboom commented Jun 5, 2012

Copy link
Copy Markdown
Member

@cgohlke -- it looks like your fork of matplotlib has been removed, making it impossible for me to review this pull request. Any idea what might have happened?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mdboom

mdboom commented Jun 5, 2012

Copy link
Copy Markdown
Member

I was able to get the diff manually from here:

https://github.com/matplotlib/matplotlib/pull/616.diff

so all is not lost -- I should be able to verify and merge this by hand.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mdboom added a commit that referenced this pull request Jun 5, 2012
@mdboom
Merge pull request #616
14a4386
@mdboom

mdboom commented Jun 5, 2012

Copy link
Copy Markdown
Member

Merged into master

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mdboom mdboom closed this Jun 5, 2012
@cgohlke

cgohlke commented Jun 5, 2012

Copy link
Copy Markdown
Contributor Author

Thanks. My matplotlib fork got corrupted.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cgohlke cgohlke mentioned this pull request Jun 23, 2012
Add detection of file extension for file-like objects #963
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@cgohlke @mdboom @jdh2358
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.