forked from matplotlib/matplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pdf: Use explicit palette when saving indexed images
Asking Pillow for an "adaptive palette" does not appear to guarantee that the chosen colours will be the same, even if asking for exactly the same number as exist in the image. And asking Pillow to quantize with an explicit palette does not work either, as Pillow uses a cache that trims the last two bits from the colour and never makes an explicit match. python-pillow/Pillow#1852 (comment) So instead, manually calculate the indexed image using some NumPy tricks. Additionally, since now the palette may be smaller than 256 colours, Pillow may choose to encode the image data with fewer than 8 bits per component, so we need to properly reflect that in the decode parameters (this was already done for the image parameters). The effect on test images with _many_ colours is small, with a maximum RMS of 1.024, but for images with few colours, the result can be completely wrong as in the reported matplotlib#25806.
- Loading branch information
Showing
21 changed files
with
46 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-302 Bytes
(97%)
lib/matplotlib/tests/baseline_images/test_agg_filter/agg_filter_alpha.pdf
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+41 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_axes/imshow_clip.pdf
Binary file not shown.
Binary file modified
BIN
+21 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_backend_pdf/grayscale_alpha.pdf
Binary file not shown.
Binary file modified
BIN
-466 Bytes
(88%)
lib/matplotlib/tests/baseline_images/test_image/bbox_image_inverted.pdf
Binary file not shown.
Binary file modified
BIN
-15.6 KB
(73%)
lib/matplotlib/tests/baseline_images/test_image/figimage.pdf
Binary file not shown.
Binary file modified
BIN
+66 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_image/image_alpha.pdf
Binary file not shown.
Binary file modified
BIN
-237 Bytes
(99%)
lib/matplotlib/tests/baseline_images/test_image/image_interps.pdf
Binary file not shown.
Binary file modified
BIN
+22 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_image/image_placement.pdf
Binary file not shown.
Binary file modified
BIN
+29 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_image/image_shift.pdf
Binary file not shown.
Binary file modified
BIN
+571 Bytes
(120%)
lib/matplotlib/tests/baseline_images/test_image/imshow.pdf
Binary file not shown.
Binary file modified
BIN
+195 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_image/imshow_masked_interpolation.pdf
Binary file not shown.
Binary file modified
BIN
-942 Bytes
(80%)
lib/matplotlib/tests/baseline_images/test_image/log_scale_image.pdf
Binary file not shown.
Binary file modified
BIN
+44 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_image/no_interpolation_origin.pdf
Binary file not shown.
Binary file modified
BIN
+23 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_image/rotate_image.pdf
Binary file not shown.
Binary file modified
BIN
-3.8 KB
(66%)
lib/matplotlib/tests/baseline_images/test_patheffects/patheffect1.pdf
Binary file not shown.
Binary file modified
BIN
-184 Bytes
(99%)
lib/matplotlib/tests/baseline_images/test_streamplot/streamplot_colormap.pdf
Binary file not shown.
Binary file modified
BIN
+22 Bytes
(100%)
lib/matplotlib/tests/baseline_images/test_tightlayout/tight_layout5.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters