From 4dbb738bd777d42a62de66f7d111cc728b518ba2 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 26 May 2021 23:56:46 +0530 Subject: removing old --- posts/2020-01-14-Converting-between-PIL-NumPy/index.html | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 posts/2020-01-14-Converting-between-PIL-NumPy/index.html (limited to 'posts/2020-01-14-Converting-between-PIL-NumPy') diff --git a/posts/2020-01-14-Converting-between-PIL-NumPy/index.html b/posts/2020-01-14-Converting-between-PIL-NumPy/index.html deleted file mode 100644 index 4735097..0000000 --- a/posts/2020-01-14-Converting-between-PIL-NumPy/index.html +++ /dev/null @@ -1,15 +0,0 @@ -Converting between image and NumPy array | Navan Chauhan
1 minute readCreated on January 14, 2020Last modified on June 1, 2020

Converting between image and NumPy array

import numpy -import PIL - -# Convert PIL Image to NumPy array -img = PIL.Image.open("foo.jpg") -arr = numpy.array(img) - -# Convert array to Image -img = PIL.Image.fromarray(arr) -

Saving an Image

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) -
Tagged with:
\ No newline at end of file -- cgit v1.2.3