Matlab Version : 7.8.0
I am reading a bmp file in matlab by using imread function -
i = imread('lena.bmp');
now i want to convert this i matrix into gif format. But since we don't have color map table, how could we do so.
is there a way to generate map vector from the image?
The trick is using rgb2ind
:
[x,map]=rgb2ind(i,256);
imwrite(x,map,'C:\test.gif');
I assumed that you want to use 256 colors in your color map. You can play with it to create more/less color quantization vs. file size.