Moritz Groß
Moritz Groß

Reputation: 1490

Why are image colors distorted in PyCharm?

I wanted to read in JPG with Pillow and then show it with imshow from matplotlib, but the image doesn't look like the original file. What's wrong?

img = Image.open("my_pics/cat.jpg")
arr = np.array(img)
plt.imshow(arr)

enter image description here

Upvotes: 6

Views: 2625

Answers (2)

Angel Gaspar
Angel Gaspar

Reputation: 191

You can go to Preferences -> Languages & Frameworks -> Jupyter and uncheck invert image outputs for dark themes. You will need to reopen the editor to apply the change.

Upvotes: 19

Moritz Groß
Moritz Groß

Reputation: 1490

The Dark-Mode in Pycharm alters the image (as of Feb. 22nd '22).

Maybe JetBrains will patch this in future updates.

Upvotes: 5

Related Questions