Loading indexed png file. #2408

warmspringwinds opened this Issue Dec 19, 2016 · 0 comments


None yet

1 participant

warmspringwinds commented Dec 19, 2016 edited


I have recently tried to an indexed png image in scikit-image, but didn't find a way to
make it using skimage.io imread.

Basically if a png file is an indexed array, in matlab you can load it as two separate arrays. One of them
will be a one dimensional array and another one will represent a look up table which will map
each index to a unique color.

In matlab it can be done using:

[im, colormap] = imread('indexed.png');

Using PIL library:

from PIL import Image
import numpy as np
im = Image.open("image.png") # Replace with your image name here
indexed = np.array(im) 

There is more about this problem here:

Is it possible to do the same but using skimage.io imread and plugin argument, assuming
that I have PIL installed?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment