View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Grayscale to RGB Converter

3.7 | 8 ratings Rate this file 82 Downloads (last 30 days) File Size: 257 KB File ID: #13312 Version: 1.0

Grayscale to RGB Converter



08 Dec 2006 (Updated )

Convert grayscale images to RGB using a specified colormap.

| Watch this File

File Information

The function converts grayscale images to RGB using a specified colormap. The default colormap is ``hot''. The graysale image is supplied either as a name or a matrix.


res = grs2rgb(im,cmap);

res is a size(im)-by-3 RGB image.


Gray Image To Color Image Conversion inspired this file.

This file inspired Rgb2hex And Hex2rgb.

MATLAB release MATLAB 7.3 (R2006b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (10)
26 Jan 2017 obaldia

It is simple in two lines:
[tmpng cmap] = rgb2ind(im);
[res] = ind2rgb(tmpng Newcmap);

27 Mar 2014 Ketul Patel

03 Nov 2012 mohammed

nice algorithm

Comment only
17 May 2011 Petter

Petter (view profile)

12 Jan 2011 Jasmin

Jasmin (view profile)

20 Oct 2008 jorge Vega Sanchez

very good program

18 Jul 2008 chris cookson

worked great for me, i couldn't believe there wasn't a SIMPLE way to do this already. good work.

11 Jul 2008 Shairyar Malik

Its a beautiful code, excelent effort...
Allah Bless You...

17 Jun 2008 meerab asd

09 Dec 2006 Joaquim Luis

Matlab already contains one (two) function to do this purpose. It is IND2RGB. Image Processing Tbx has a MEX (very fast and very
low memory overhead) called ind2rgb8.
Your function converts the UINT8 image to DOUBLES. This is a awfull memory consumption.

Comment only
11 Dec 2006

Examples added and M-lint message taken care of.

Contact us