X Tutup
Skip to content

BUG: saving image to png changes colors #6607

@efiring

Description

@efiring

On v2.x, (qtagg backend on OSX) run:

import numpy as np
import matplotlib.pyplot as plt

small_im = np.array([[0.25, 0.75, 1.0], [0.1, 0.65, 0.5],
                     [0.6, 0.3, 0.0]])

fig, ax = plt.subplots()
ax.imshow(small_im, interpolation='nearest')
fig.savefig('t1.png')
fig.savefig('t1.pdf')
plt.show()

Consider the yellow block in the upper RH corner. Using the OSX DigitalColor Meter, the color is (253, 231, 36). Now use Preview to look at the two saved files. The color in the pdf is the same as in the figure window, but the color in the saved png is (252, 229, 63), and visibly differs from the color in the pdf and on the screen.
I ran into this while trying to fix #6591.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup