imsave should preserve alpha channel#1956
Conversation
lib/matplotlib/image.py
Outdated
There was a problem hiding this comment.
Does the transparent kwarg on savefig do the same thing? (http://matplotlib.org/faq/howto_faq.html#save-transparent-figures)
There was a problem hiding this comment.
You're right, it does. (Silly me, I'd forgotten about that option.)
I've updated the branch to use that instead.
|
Ah. Unfortunately the travis-ci instance has this test failing: https://s3.amazonaws.com/archive.travis-ci.org/jobs/6792238/log.txt |
|
That's because #1868 hasn't been merged. (This hits the same problem that that fixes.) On my test branch with both patches applied, the test passes. |
Doh! Time to go home - its been a long day 😄 |
|
Oh, oops. I think I half-botched a rebase of this branch, but the overall diff is still correct. |
I think we only need a single commit for this change, so would you mind going ahead and squashing your changes? if its more trouble than its worth, don't worry about it though. |
Done (and managed to do it right this time.) |
|
👍 -- @pelson: I leave it to you to push the green button since you've been following all this closer than I. |
Imsave now preserves the alpha channel.
While looking at test_image, I noticed the comment that
imsavewas flattening alpha channel data. I figured this was related to #1868 (it is, partially), and decided to fix it.I've updated the test to reflect that an imsave/imread round-trip should now preserve full RGBA data to within 1/255.
Passing the test, however, requires that the patches from #1868 also be applied.