How to add colormap on an image?

조회 수: 61 (최근 30일)
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota 2021년 12월 7일
편집: Rik 2021년 12월 7일
Add colormap on a .png/.jpeg image.
  댓글 수: 1
Rik
Rik 2021년 12월 7일
A colormap only has meaning for indexed images. Are your image actually indexed? And what have you tried?

댓글을 달려면 로그인하십시오.

답변 (2개)

Constantino Carlos Reyes-Aldasoro
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 2021년 12월 7일
편집: Rik 2021년 12월 7일
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.

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by