Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
MNT: improve image array argument checking in to_rgba. Closes #2499. #6122
Conversation
efiring
changed the title from
MNT: improve image array argument checking in to_rgba. Closes #2499. to MNT: improve image array argument checking in to_rgba. Closes #2499.
Mar 7, 2016
efiring
added the
needs_review
label
Mar 7, 2016
|
tacaswell
modified the milestone: 2.0 (style change major release), 2.1 (next point release)
Mar 7, 2016
tacaswell
added a commit
that referenced
this pull request
Mar 7, 2016
|
|
tacaswell |
7df8f0d
|
tacaswell
merged commit 7df8f0d
into matplotlib:master
Mar 7, 2016
tacaswell
removed the
needs_review
label
Mar 7, 2016
mdboom
commented on the diff
Mar 7, 2016
| @@ -255,10 +254,18 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True): | ||
| xx = x | ||
| else: | ||
| raise ValueError("third dimension must be 3 or 4") | ||
| - if bytes and xx.dtype != np.uint8: | ||
| - xx = (xx * 255).astype(np.uint8) | ||
| - if not bytes and xx.dtype == np.uint8: | ||
| - xx = xx.astype(float) / 255 | ||
| + if xx.dtype.kind == 'f': | ||
| + if xx.max() > 1 or xx.min() < 0: |
mdboom
Owner
|
|
Is this going to be backported? While it's milestoned 2.1, the original issue is milestoned 2.0. |
|
I am 50/50 on backporting. |
|
And we should wait for @mdboom 's follow on commit in either case. |
efiring commentedMar 7, 2016
No description provided.