Borrar filtros
Borrar filtros

How to add colormap on an image?

45 visualizaciones (últimos 30 días)
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota el 7 de Dic. de 2021
Editada: Rik el 7 de Dic. de 2021
Add colormap on a .png/.jpeg image.
  1 comentario
Rik
Rik el 7 de Dic. de 2021
A colormap only has meaning for indexed images. Are your image actually indexed? And what have you tried?

Iniciar sesión para comentar.

Respuestas (2)

Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro el 7 de Dic. de 2021
I guess that this is a 2 step question, you want to add a colormap and then export as a png or jpeg, try the following, read an image, display and change colormap
a=imread('moon.tif');
imagesc(a)
colormap(autumn)
Now you can export as any format you want:
print('-dpng','-r100','myImage.png')

Rik
Rik el 7 de Dic. de 2021
Editada: Rik el 7 de Dic. de 2021
In case you don't want to make a screenshot of your image with print, you can use ind2rgb:
a=imread('moon.tif');
map=colormap(autumn);
b=ind2rgb(a,map);
imshow(b)
Now you can use imwrite to write this RGB image to a file.

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by