5

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

Moritz Groß
  • 1,352
  • 12
  • 30
  • You can use ```Ctrl + ` ``` for the theme quick switcher, see [this post](https://stackoverflow.com/a/67280505). – bad_coder Feb 22 '22 at 22:27
  • @bad_coder Sorry for the dumb question, but how to you type the second charater? In my german keyboard layout you type ` by using Shift + the button left to backspace, so it's a combination as well and not a single key. – Moritz Groß Feb 22 '22 at 22:48
  • See the first post I linked, the name of the action to remap is "quick switch" (use the search within the keymap dialogue) if the backtick character ` isn't convenient on your keyboard you should remap it. – bad_coder Feb 22 '22 at 22:52
  • @bad_coder For which layouts is ` its own key? US? – Moritz Groß Feb 22 '22 at 22:55
  • The backtick is never it's own key afaik but in countries that use it as [diactiric](https://en.wikipedia.org/wiki/Diacritic) it's used with Shift and placed conveniently on the keyboard. (I think the shift only shows in the keymap for upper case characters not for diacritics.) – bad_coder Feb 22 '22 at 22:56

2 Answers2

8

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.

Angel Gaspar
  • 81
  • 1
  • 4
4

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

Maybe JetBrains will patch this in future updates.

Moritz Groß
  • 1,352
  • 12
  • 30