View License

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

» Watch video

Highlights from
Gray image to Color image conversion

  • gray2rgb(img1,img2)%This Program converts a gray image ro RGB image based on the colors of the destination image. The better the destination image match with the source %
  • View all files
4.3 | 33 ratings Rate this file 63 Downloads (last 30 days) File Size: 61.9 KB File ID: #8214 Version: 1.0
image thumbnail

Gray image to Color image conversion


Jeny Rajan (view profile)


04 Aug 2005 (Updated )

Converts a gray image to color image

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

This program converts a gray image to color image. The conversion is based on color image submitted along with the input gray image. Actualy it transfers color to a grayscale image. The implementation id based on the paper "Transferring Color to greyscalale Images" by Tomihisa Welsh et. al.


This file inspired Grayscale To Rgb Converter, Comparison Of Edge Detectors, and Gray To Color Image Conversion.

Required Products Image Processing Toolbox
MATLAB release MATLAB 6.5 (R13)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (40)
04 Jun 2016 mohamed jad

thank you it is very useful

Comment only
16 Jun 2015 B.k Sumedha

Well that was a gud demo.But cant it done without using an reference image.

16 Jun 2015 B.k Sumedha

16 Jun 2015 B.k Sumedha

16 Jun 2015 B.k Sumedha

10 May 2015 Aasd

Aasd (view profile)

perfect supereb

15 Mar 2015 james zhan


29 Sep 2014 ravin the cat


Comment only
23 May 2014 Lin Jason

It's powful,thank a lot

04 Apr 2014 Afzal

Afzal (view profile)

the command window says specify the name or matrix of the image. i did as asked. specified the gray scale image(image_name.fig). but it shows error. any suggestions.
thank you

17 Apr 2013 narendra dewangan


19 Nov 2012 NN Misra

Thanks, was very helpful.

23 Jan 2012 Jamuna Jayashri Mahalingam

How does one convert a binary image to a grayscale image?

Comment only
12 Jan 2012 Vikesh Katkar

i want code for edge preserving image denoising

Comment only
25 Nov 2011 mostafa saeed

18 May 2011 shanxi taiyuan

very good

Comment only
05 Aug 2008 aravindan samarasam

27 Jan 2008 kathir avan


22 Oct 2007 r c


i want full project using matlab

25 Jul 2007 vedha pounraj

i want full project using matlab

24 Jul 2007 subha shini

sent full information about grey to colour image conversion for project use.

Comment only
14 Jun 2007 sobia sobia

i want to color image code in matlab

Comment only
27 Mar 2007 Abhilekh Gupta

its wonderful save my lot of time in converting gray images to color.

12 Mar 2007 someone somewhere

10 Dec 2006 Alex Chirokov

It is amazing, works like magic.

14 Nov 2006 Hae Min

Fantastic!!!!! You just saved me $$$$$$$ from purchasing a bunch of jargon-written books with no useful information!!!!

14 Oct 2006 tolga kök

You are perfect..!

09 Oct 2006 Punit Master

try to write the function which do not require coloured image for the transformation from grayscale to colour image

27 May 2006 mehmed Aliwa

thank good

26 May 2006 Kevin Deffrunger

Thank you very much.

26 May 2006 John Michael

God bless you

26 May 2006 Maria Bledee


26 May 2006 ayse kaya

05 Mar 2006 Ionut Alex

Hi! I'm trying to use the "Colorization using Optimization" algorithm (you can find it here on animated gifs. They gave some exemples on their site. The method worked for still images, but I don't know how to use it for animated gifs. Can someone help me please? It is rather important for me. Thank you in advance. My e-mail is

28 Feb 2006 Kevin Dsouza

Thanks a Lot...God bless U

18 Dec 2005 ragad ragad

10 Aug 2005 Roopak Sudhakar

Good work! Can be useful for converting old B/W photos & films to color.

07 Aug 2005 Vladimir Melnik

Please submit files in .m or .zip format.
It is extra work to open in Windows environment.

05 Aug 2005 Sreejith A

Good work done by you.

22 Apr 2016 1.0

adding BSD license

Contact us