###script to test saving a colour image of what imagesc displays clear all; #a=(peaks()+10)/20*255; mHist2d=peaks(); i_min= min(reshape(mHist2d,1,[])); i_max= max(reshape(mHist2d,1,[])); #a= uint8((mHist2d - i_min)/(i_max-i_min)*255+1); a= (mHist2d - i_min)/(i_max-i_min)*255; min(reshape(a,1,[])) max(reshape(a,1,[])) Nmax= 128; c_extension= 1.1429; midcmap= jet(Nmax*c_extension); ##some octave magick to delete dark red colours;-) del_p = midcmap(:,1) < 1 & midcmap(:,2) == 0 & midcmap(:,3) == 0; before= size(midcmap) midcmap(del_p,:)= []; after= size(midcmap) c_extension= before/after ##== 1.1428 #c_extension= 1.1428; ##magick done cmap= midcmap; imagesc(a) axis('equal'); colormap(cmap) caxis([0, 255]) imwrite(uint8(a/1+1), colormap(cmap), "test_01.png", "png"); #hist values must be in [1;256]; only [1;256] from cmap is used!!! imwrite(uint8(a/2+1), colormap(cmap), "test_02.png", "png"); imwrite(uint8(a/3+1), colormap(cmap), "test_03.png", "png"); Nmax= 256; c_extension= 1.1429; midcmap= jet(Nmax*c_extension); ##some octave magick to delete dark red colours;-) del_p = midcmap(:,1) < 1 & midcmap(:,2) == 0 & midcmap(:,3) == 0; before= size(midcmap) midcmap(del_p,:)= []; after= size(midcmap) c_extension= before/after ##== 1.1428 #c_extension= 1.1428; ##magick done cmap= midcmap; imwrite(uint8(a/1+1), colormap(cmap), "test_00.png", "png"); Nmax= 1024; c_extension= 1.1429; midcmap= jet(Nmax*c_extension); ##some octave magick to delete dark red colours;-) del_p = midcmap(:,1) < 1 & midcmap(:,2) == 0 & midcmap(:,3) == 0; before= size(midcmap) midcmap(del_p,:)= []; after= size(midcmap) c_extension= before/after ##== 1.1428 #c_extension= 1.1428; ##magick done cmap= midcmap; imwrite(uint8(a/1+1), colormap(cmap), "test_10.png", "png");