From d75527f7eecc4e2fcdd18ab157412506717c8adb Mon Sep 17 00:00:00 2001 From: navanchauhan Date: Mon, 7 Nov 2022 23:36:11 -0700 Subject: add blog post --- docs/posts/2020-01-14-Converting-between-PIL-NumPy.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'docs/posts/2020-01-14-Converting-between-PIL-NumPy.html') diff --git a/docs/posts/2020-01-14-Converting-between-PIL-NumPy.html b/docs/posts/2020-01-14-Converting-between-PIL-NumPy.html index 293da91..1db31be 100644 --- a/docs/posts/2020-01-14-Converting-between-PIL-NumPy.html +++ b/docs/posts/2020-01-14-Converting-between-PIL-NumPy.html @@ -43,7 +43,8 @@

Converting between image and NumPy array

-
import numpy
+
+
import numpy
 import PIL
 
 # Convert PIL Image to NumPy array
@@ -52,16 +53,19 @@
 
 # Convert array to Image
 img = PIL.Image.fromarray(arr)
-
+
+

Saving an Image

-
try:
+
+
try:
     img.save(destination, "JPEG", quality=80, optimize=True, progressive=True)
 except IOError:
     PIL.ImageFile.MAXBLOCK = img.size[0] * img.size[1]
     img.save(destination, "JPEG", quality=80, optimize=True, progressive=True)
-
+
+
-- cgit v1.2.3