Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

imsave should preserve alpha channel#1956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pelson merged 1 commit intomatplotlib:masterfromWestacular:imsave_alpha
May 3, 2013

Conversation

Westacular
Copy link
Contributor

While looking at test_image, I noticed the comment thatimsave was 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.

@@ -1273,7 +1273,8 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
fig = Figure(figsize=figsize, dpi=dpi, frameon=False)
canvas = FigureCanvas(fig)
im = fig.figimage(arr, cmap=cmap, vmin=vmin, vmax=vmax, origin=origin)
fig.savefig(fname, dpi=dpi, format=format)
fig.patch.set_alpha(0)
Copy link
Member

Choose a reason for hiding this comment

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

Does thetransparent kwarg on savefig do the same thing? (http://matplotlib.org/faq/howto_faq.html#save-transparent-figures)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

You're right, it does. (Silly me, I'd forgotten about that option.)

I've updated the branch to use that instead.

@pelson
Copy link
Member

Ah. Unfortunately the travis-ci instance has this test failing:https://s3.amazonaws.com/archive.travis-ci.org/jobs/6792238/log.txt
Surprisingly the numbers are quite different.

@Westacular
Copy link
ContributorAuthor

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.

@pelson
Copy link
Member

That's because#1868 hasn't been merged.

Doh! Time to go home - its been a long day 😄

@Westacular
Copy link
ContributorAuthor

Oh, oops. I think I half-botched a rebase of this branch, but the overall diff is still correct.

@pelson
Copy link
Member

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.

@Westacular
Copy link
ContributorAuthor

I think we only need a single commit for this change, so would you mind going ahead and squashing your changes?

Done (and managed to do it right this time.)

@mdboom
Copy link
Member

👍 --@pelson: I leave it to you to push the green button since you've been following all this closer than I.

pelson added a commit that referenced this pull requestMay 3, 2013
Imsave now preserves the alpha channel.
@pelsonpelson merged commitb6b9062 intomatplotlib:masterMay 3, 2013
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v1.3.x
Development

Successfully merging this pull request may close these issues.

3 participants
@Westacular@pelson@mdboom

[8]ページ先頭

©2009-2025 Movatter.jp