Question

When I read a color JPEG image:

jpgim = imread('path/to/image.jpg')

I get an MxNx3 array. However, with GIF files I also need to read the colormap:

[gifim, map] = imread('path/to/image2.gif')

Let's assume that I need only the first frame if the GIF image is animated: gifim = gifim(:,:,:,1) Is there a way to get a standard MxNx3 image array using gifim and map as that is what later parts of my processing pipeline expect?

Was it helpful?

Solution

Use ind2rgb:

im = ind2rgb(gifim, map);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top