Python: Difference between revisions

330 bytes added ,  27 April 2020
Line 360: Line 360:
; Notes
; Notes
* Using <code>json.dump(data, f)</code> will dump without pretty printing
* Using <code>json.dump(data, f)</code> will dump without pretty printing
===Pillow (PIL)===
<code>pip install pillow</code>
====Images====
<syntaxhighlight lang="python>
from PIL import Image
from
img = Image.open("my_image.png")
# Converts to int array of shape (H,W,4)
img = np.array(img)
</syntaxhighlight>
* <code>flip()</code> - flips across y axis
* <code>mirror()</code> - flips across x axis


==Libraries==
==Libraries==