Title: Filter images in premultiplied alpha mode. by anntzer · Pull Request #29776 · matplotlib/matplotlib · GitHub
Open Graph Title: Filter images in premultiplied alpha mode. by anntzer · Pull Request #29776 · matplotlib/matplotlib
X Title: Filter images in premultiplied alpha mode. by anntzer · Pull Request #29776 · matplotlib/matplotlib
Description: Test e.g. with import matplotlib.pyplot as plt import numpy as np fig = plt.figure(figsize=(6, 6)) img = np.zeros((5, 5, 4)) img[..., 1] = 1. img[..., 3] = np.tril(np.ones((5, 5))) fig.add_subplot(221).imshow(img, interpolation="bilinear") fig.add_subplot(222).imshow((img * 0xff).astype("u1"), interpolation="bilinear") fig.add_subplot(212).imshow( np.where( np.mgrid[:100, :200][0] > np.random.randint(100, size=200), np.arange(100)[:, None], np.nan), cmap="Greens", interpolation="antialiased", interpolation_stage="rgba") plt.show() Implements #29711 (comment) which is part of #29711 (but there is another part to that issue as well). Some test failures due to tiny rendering differences remain, and I would like to investigate whether they can be suppressed by tweaking the conversion to/from premultiplied alpha (in particular, should the alpha channel be multiplied by 0xff or 0x100?). The change in downsampling_speckle.py is clearly for the better, it suppresses a tiny gray band at the boundary between data and no data (visible with "swipe" diff) similar to the one shown in #29711 (comment). See also #11316 and #12062, which should be subsumed by this fix. PR summary PR checklist "closes #0000" is in the body of the PR description to link the related issue new and changed code is tested Plotting related features are demonstrated in an example New Features and API Changes are noted with a directive and release note Documentation complies with general and docstring guidelines
Open Graph Description: Test e.g. with import matplotlib.pyplot as plt import numpy as np fig = plt.figure(figsize=(6, 6)) img = np.zeros((5, 5, 4)) img[..., 1] = 1. img[..., 3] = np.tril(np.ones((5, 5))) fig.add_subplot...
X Description: Test e.g. with import matplotlib.pyplot as plt import numpy as np fig = plt.figure(figsize=(6, 6)) img = np.zeros((5, 5, 4)) img[..., 1] = 1. img[..., 3] = np.tril(np.ones((5, 5))) fig.add_subplot...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/29776
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c2297164-ab7e-3dcc-1a90-95edd84efe95 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 80EA:101A9F:10D2B46:1663120:6A533B18 |
| html-safe-nonce | a8abdb758a5df5c85d1ec4f4c4fcf93a3503f9d37b6675cb858c60ea75825d0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEVBOjEwMUE5RjoxMEQyQjQ2OjE2NjMxMjA6NkE1MzNCMTgiLCJ2aXNpdG9yX2lkIjoiNDMxODgzODk3MDgyODE0MzM4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3dda456f286a66f9867165de2c8f856f7c2f705beac4d1542e5e16d371c5ad82 |
| hovercard-subject-tag | pull_request:2402296301 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/29776/files |
| twitter:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| og:image:alt | Test e.g. with import matplotlib.pyplot as plt import numpy as np fig = plt.figure(figsize=(6, 6)) img = np.zeros((5, 5, 4)) img[..., 1] = 1. img[..., 3] = np.tril(np.ones((5, 5))) fig.add_subplot... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width