From 211a88b8d606869360c7cdb5555d56d7c2e06492 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sat, 18 Jan 2020 22:05:16 +0530 Subject: Publish deploy 2020-01-18 22:05 --- .../index 2.html | 19 ------------------- .../index 3.html | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 posts/2020-01-14-Converting-between-PIL-NumPy/index 2.html create mode 100644 posts/2020-01-14-Converting-between-PIL-NumPy/index 3.html (limited to 'posts/2020-01-14-Converting-between-PIL-NumPy') diff --git a/posts/2020-01-14-Converting-between-PIL-NumPy/index 2.html b/posts/2020-01-14-Converting-between-PIL-NumPy/index 2.html deleted file mode 100644 index 9e21e26..0000000 --- a/posts/2020-01-14-Converting-between-PIL-NumPy/index 2.html +++ /dev/null @@ -1,19 +0,0 @@ -Converting between image and NumPy array | Navan Chauhan
🕑 0 minute read.

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 diff --git a/posts/2020-01-14-Converting-between-PIL-NumPy/index 3.html b/posts/2020-01-14-Converting-between-PIL-NumPy/index 3.html new file mode 100644 index 0000000..77a91e7 --- /dev/null +++ b/posts/2020-01-14-Converting-between-PIL-NumPy/index 3.html @@ -0,0 +1,19 @@ +Converting between image and NumPy array | Navan Chauhan
🕑 0 minute read.

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