more off clear clf % --------- BEGIN user-servicable parts --------- BaseName='NGC7217'; % The next 3 numbers should be determined by knowledge of the true colour % magnitudes of field stars. Rhi=500; Ghi=230; Bhi=75; % --------- END user-servicable parts --------- % Load in the bands [hdr,imgB]=fitsload([BaseName,'-B.fits']); [hdr,imgV]=fitsload([BaseName,'-V.fits']); [hdr,imgR]=fitsload([BaseName,'-R.fits']); % Scale the bands imgr=imgR/Rhi; imgg=imgV/Ghi; imgb=imgB/Bhi; % Create the 3-colour array, one plane for each of RGB img=cat(3,imgr,imgg,imgb); % Truncate the frames to the range [0,1] img(img<0)=0*img(img<0); img(img>1)=0*img(img>1)+1; % Display the image to the screen image(img) set(gca,'ydir','norm') % Write the image to file. imwrite(img,[BaseName,'-RGB.tif'],'tif') imwrite(img,[BaseName,'-RGB.png'],'png')