You can use newer OpenCV python interface (if I'm not mistaken it is available since OpenCV 2.2). It natively uses numpy arrays:

import cv2
im = cv2.imread("abc.tiff")
print(type(im))

result:

<type 'numpy.ndarray'>
Answer from Andrey Kamaev on Stack Overflow
🌐
scikit-image
scikit-image.org › skimage-tutorials › lectures › 00_images_are_arrays.html
Images are numpy arrays — Image analysis in Python
Images are represented in scikit-image using standard numpy arrays. This allows maximum inter-operability with other libraries in the scientific Python ecosystem, such as matplotlib and scipy. Let’s see how to build a grayscale image as a 2D array:
🌐
DataCamp
datacamp.com › doc › numpy › converting-images-to-numpy
Converting Images to NumPy
This example loads an image named `example.jpg` and converts it into a NumPy array, printing its shape, which represents the dimensions of the image in the format (height, width, channels).
Discussions

python - how to load a color image file as a numpy array? - Stack Overflow
Beware that cv2.imread() returns a numpy array in BGR not RGB. 2017-01-25T20:55:34.88Z+00:00 ... OpenCV seem to have dropped the mode argument. See my answer below for an updated method. 2019-03-09T20:57:50.873Z+00:00 ... PIL (Python Imaging Library) and Numpy work well together. More on stackoverflow.com
🌐 stackoverflow.com
python - How do I convert a PIL Image into a NumPy array? - Stack Overflow
How do I convert a PIL Image back and forth to a NumPy array so that I can do faster pixel-wise transformations than PIL's PixelAccess allows? I can convert it to a NumPy array via: pic = Image.open(& More on stackoverflow.com
🌐 stackoverflow.com
python - How to Convert Image to numpy array, then convert it back to image by script - Blender Stack Exchange
I know this can be done with matplotlib or PIL, but I need it to be done in blender, without installing any other package. I searched and tried following code in blender, but only get a black image... More on blender.stackexchange.com
🌐 blender.stackexchange.com
Can I save a numpy array as an image?
Hmm, I tried SciPy's imsave, but all I get as an output is a small black square. I'm not sure if I'm doing something wrong, but I'll play around with it. Edit: Ah, I think I got it! I just had to set the white squares to a value of 255 and the black squares to a value of 0. Perfect, thanks so much! More on reddit.com
🌐 r/learnpython
4
4
January 20, 2016
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-convert-images-to-numpy-array
How to Convert images to NumPy array? - GeeksforGeeks
July 15, 2025 - Explanation: It converts a PIL image to a NumPy array using img_to_array() for processing, then back to a PIL image using array_to_img(), confirming smooth transformation with array type float32 and shape (200, 400, 3).
🌐
Pluralsight
pluralsight.com › blog › tech guides & tutorials
Importing Image Data Into NumPy Arrays | Pluralsight
April 15, 2025 - You can also resize the array of the pixel image and trim it. After performing the manipulations, it is important to save the image before performing further steps. The format argument saves the file in different formats, such as PNG, GIF, or PEG. For example, the code below loads the photograph in JPEG format and saves it in PNG format. import numpy as np from PIL import Image im = np.array(Image.open('kolala.jpeg').convert('L')) #you can pass multiple arguments in single line print(type(im)) gr_im= Image.fromarray(im).save('gr_kolala.png')
🌐
AskPython
askpython.com › python › examples › convert-images-to-numpy-arrays
How to Convert Images to Numpy Arrays in Python - AskPython
April 21, 2026 - Pillow is the go-to library for basic image loading in Python. Pair it with numpy.asarray() and you get an array without installing anything heavy.
🌐
Cloudinary
cloudinary.com › home › convert image to numpy array: methods, tips, and examples
Convert Image to NumPy Array: Methods, Tips, and Examples | Cloudinary
January 24, 2026 - NumPy handles the array operations, while image libraries such as Pillow, OpenCV, Matplotlib, or scikit-image handle reading the image file into memory. Each library loads images slightly differently, but all of them return data that can be represented as a NumPy array. Before running the examples in this guide, we’ll install NumPy and the imaging libraries we plan to use.
Find elsewhere
🌐
w3resource
w3resource.com › python-exercises › numpy › python-numpy-exercise-108.php
Python NumPy: Convert a PIL Image into a NumPy array - w3resource
August 29, 2025 - Create a function that transforms a PIL image into grayscale and returns the corresponding NumPy array. Test the conversion with images of different modes (RGB, L, RGBA) and compare the array dimensions.
🌐
GitHub
gist.github.com › b4f7bed3c4c059a765c89315f522db27
Converting and saving images to numpy array. · GitHub
Converting and saving images to numpy array. GitHub Gist: instantly share code, notes, and snippets.
🌐
Linux Hint
linuxhint.com › pil-image-to-numpy-array
Linux Hint – Linux Hint
November 9, 2022 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
🌐
Educative
educative.io › answers › convert-a-pil-image-to-numpy-array
Convert a PIL image to NumPy array
Converting a PIL image to NumPy array helps in image processing and numerical analysis.
🌐
Javatpoint
javatpoint.com › how-to-convert-images-to-numpy-array
How to Convert Images to NumPy Array - Javatpoint
How to Convert Images to NumPy Array with tutorial, tkinter, button, overview, canvas, frame, environment set-up, first python program, etc.
🌐
GitHub
github.com › foolmarks › images_to_npy
GitHub - foolmarks/images_to_npy: Converting images to numpy files · GitHub
To save time during training, it can be useful to convert a dataset of images to numpy arrays, pre-process them (scaling, normalization, etc) and then save as one or more binary numpy files.
Starred by 28 users
Forked by 10 users
Languages: Python
🌐
Uploadcare
uploadcare.com › processing & transformations category › fast pillow image import to numpy and opencv arrays
Fast Pillow image import to NumPy and OpenCV arrays | Uploadcare
September 7, 2021 - Here are the two most common ways to convert a Pillow image to NumPy. If you Google it, you’ll probably find one of them: numpy.array(im) — makes a copy from an image to a NumPy array.
🌐
PyPI
pypi.org › project › image-to-numpy
image-to-numpy · PyPI
Load an image file into a numpy array - while automatically rotating the image based on Exif orientation. Prevents upside-down and sideways images! import image_to_numpy img = image_to_numpy.load_image_file("my_file.jpg")
      » pip install image-to-numpy
    
Published: Oct 09, 2019
Version: 1.0.0
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
Image processing with Python, NumPy | note.nkmk.me
October 20, 2020 - Passing the image data read by PIL.Image.open() to np.array() returns 3D ndarray whose shape is (row (height), column (width), color (channel)). from PIL import Image import numpy as np im = np.array(Image.open('data/src/lena.jpg')) print(type(im)) ...
🌐
Roboflow
roboflow.com › use opencv › convert pil image to numpy array
Convert PIL Image to NumPy array (OpenCV)
HOW TO GUIDE · You can convert a PIL Image object into a NumPy array using the np.asarray() function: import numpy as np from PIL import Image pil_image = Image.open("image.jpeg") image = np.asarray(pil_image) OpenCV can be used with the open source supervision Python package.
🌐
Pythoninformer
pythoninformer.com › python-libraries › numpy › numpy-and-images
PythonInformer - Image processing with pillow and NumPy
October 2, 2022 - In this section, we will learn how to use NumPy to store and manipulate image data. We will use the Python Imaging Library (PIL) to read and write data to standard image file formats. This article explains how image data is stored in a NumPy array.