Title: Restore special casing of grayscale images in PostScript backend. by anntzer · Pull Request #12871 · matplotlib/matplotlib · GitHub
Open Graph Title: Restore special casing of grayscale images in PostScript backend. by anntzer · Pull Request #12871 · matplotlib/matplotlib
X Title: Restore special casing of grayscale images in PostScript backend. by anntzer · Pull Request #12871 · matplotlib/matplotlib
Description: This divides the filesize by ~3 by not storing three identical channels (e.g. compare the size of imshow(np.random.rand(255, 255), cmap="gray") gca().set_axis_off() savefig("test.ps") before and after the patch). Looks like some kind of similar functionality was present before mpl2.0, though with some weird magic factors (https://github.com/matplotlib/matplotlib/pull/5718/files#diff-b465967f537465fec4960b152fa49cffL415), and I stumbled on some vestigial leftovers of it (https://github.com/matplotlib/matplotlib/pull/5718/files#diff-b465967f537465fec4960b152fa49cffL457 where the "image" command comes from)... No hard numbers but I don't think the performance cost (on non-grayscale images) really matters as we're going to iterate through the array just after to serialize it anyways. Probably the same thing can be done for the pdf backend -- see grayscale parameter of _writeImg. PR Summary PR Checklist Has Pytest style unit tests Code is Flake 8 compliant New features are documented, with examples if plot related Documentation is sphinx and numpydoc compliant Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there) Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way
Open Graph Description: This divides the filesize by ~3 by not storing three identical channels (e.g. compare the size of imshow(np.random.rand(255, 255), cmap="gray") gca().set_axis_off() savefig("test.ps&...
X Description: This divides the filesize by ~3 by not storing three identical channels (e.g. compare the size of imshow(np.random.rand(255, 255), cmap="gray") gca().set_axis_off() savefig(&q...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/12871
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:40bf1af6-af8d-bdeb-5a8c-d9a68aaf42a2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D9CA:2D5E27:48914D:6169E5:6A51C7C7 |
| html-safe-nonce | 791efc7ab863bbf49a03465900aa30e597c8a81c9bf05581f4eb6522a4d5dbf9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUNBOjJENUUyNzo0ODkxNEQ6NjE2OUU1OjZBNTFDN0M3IiwidmlzaXRvcl9pZCI6IjgwMTAzNTA1NjcwMzI0NzM1NDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c5b7945ee3acb1b90d4bc333227d201070da61a76795cef54ff9bde708bd52b7 |
| hovercard-subject-tag | pull_request:233194130 |
| 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/12871/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 | This divides the filesize by ~3 by not storing three identical channels (e.g. compare the size of imshow(np.random.rand(255, 255), cmap="gray") gca().set_axis_off() savefig("test.ps&... |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width