Search code examples
pythonimage-processingmahotas

python mahotas.imread reads a 2d image as 3d


I have an image saved by another code of mine. The image is a normal JPG file. I saved it with imsave.

now when I'm reading it in another code, it seems to be 3d :S

the image is here.

and a simple code to read it is this :

import mahotas

img = mahotas.imread('d:/normal.jpg')
print img.shape, img.dtype

Solution

  • Try reading the jpg as greyscale like this:

    mahotas.imread('d:/normal.jpg', as_grey = True)