Skip to content Skip to sidebar Skip to footer

Cannot Convert Pil Image From Paint.net To Numpy Array

I am getting a ValueError in numpy when performing operations on images. The problem seems to be that the images edited by Paint.NET are missing the RGB dimension when opened using

Solution 1:

If PIL is giving you a 861x1091 image when you are expecting an 861x1091x3 image, that is almost certainly because it is a palette image - see here for explanation.

The simplest thing to do, if you want a 3-channel RGB image rather than a single channel palette image is to convert it to RGB when you open it:

im = Image.open(path).convert('RGB')

Post a Comment for "Cannot Convert Pil Image From Paint.net To Numpy Array"