Saving grayscale image as it appears in jet colormap of imagesc

27 views (last 30 days)
Hello, I have a grayscale TIF images (although it says it is TrueColor, nevermind). I need to convert them to grayscale and save it as it appears in imagesc(), colormap(jet) i.e. color picture.
Matlab code I use:
N = 4
FNAMEFMT = 'Frame%d.tif';
% Load images
for i=1:N
IMAGES = imread(sprintf(FNAMEFMT, i));
IMAGES = rgb2gray(IMAGES);
fname = sprintf('%s\\Frame%d.tif','C:\Project',i);
imagesc(IMAGES); axis image; colorbar; colormap(jet);
imwrite(IMAGES, fname, 'tif');
end
The pictures I import to MATLAB looking like that: http://img845.imageshack.us/img845/531/frame1m.png
And I need to save them looking like that: http://img850.imageshack.us/img850/5444/printscreenl.jpg
But the code I provided saves them again as black/white/gray.

Accepted Answer

Walter Roberson
Walter Roberson on 30 Dec 2011

More Answers (1)

Georgiy
Georgiy on 30 Dec 2011
Didn't help. It freezes the colormap in Matlab, but when I SAVE the image using imwrite(IMAGES, fname, 'tif'); they saved as grayscale.
  2 Comments
Walter Roberson
Walter Roberson on 30 Dec 2011
After you freeze the image, get() the CData property of the image handle; the data returned will be the data to imwrite()

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!