Using NumPy With Pillow
00:00 Image Manipulation With NumPy and Pillow. Pillow has an extensive selection of built-in functions and filters, but there are times when you need to manipulate images with features that are beyond those available in Pillow.
You can learn more about it in this Real Python tutorial. When you convert an image into a NumPy array, you can perform any transformations that you require directly on the pixels in the array. Once you’ve completed your processing in NumPy, you can convert the array back to an
Image object using Pillow.
00:57 Now that NumPy is installed, you are ready to use Pillow and NumPy to spot the difference between two images. Can you spot the differences between the two images seen on-screen? This particular spot-the-difference competition is not difficult, but you decide to cheat anyway and write a Python program to solve the puzzle for you.
you subtract an array from another one of the same size, the result is another array with the same shape as the originals, you can convert this array into an image using
Image.fromarray() in Pillow.
03:00 You can also see some noise surrounding the cloud and the fence, which is due to small changes in the original JPEG compression in the region surrounding these changes. In the next section of the course, you’ll see another example of how to use NumPy with Pillow by using it to create images.
Become a Member to join the conversation.