# Creating an image from data not in grayscale

I can Import data from excel and create a gray-scale image using

Image[data, "Real"]


But I want to change from grayscale and as an example use red as the color

-
Look the option ColorSpace under Image in the documentation. –  Sektor Feb 20 at 19:37
@Sektor Gray is gray, regardless of color space. –  Pickett Feb 20 at 19:48
@Pickett Oh, I missed the grayscale part :D –  Sektor Feb 20 at 21:23
Please add some actual data. –  Yves Klett Feb 21 at 7:10

Here's one way:

data = RandomReal[{0, 1}, {100, 100}];
ColorCombine[{Image[data], Image[0 data], Image[0 data]}]


This creates an RGB image which has the data as the Red channel, and all zeros in the Green and Blue channels. By weighting them differently you can get any color you wish. For instance, you can get yellow:

ColorCombine[{Image[data], Image[data], Image[0 data]}]


-

For this purpose you can use the function Colorize which is sufficient even for fancy coloring. Let's make some examples with a B&W photo

img = Import["http://i.stack.imgur.com/397vv.png"]


If you simply want to use the gray channel as one or more color channels you use

Colorize[img, ColorFunction -> Function[gray, RGBColor[0, gray, gray]]]


The same works of course with other color functions

Colorize[img, ColorFunction -> Function[gray, Hue[0.6, 1 - gray, gray]]]


With the built-in color schemes of Mathematica you can get more fancy looks and the usage is even simpler

Colorize[img, ColorFunction -> "AvocadoColors"]


Or you mix everything together

Colorize[img, ColorFunction ->
Function[gray, RGBColor @@ (gray*List @@ ColorData["BrightBands", gray])]]


-

If you have a worksheet like this one:

You could do:

id = Import["C:\\test.xlsx"];
ColorCombine[Image /@ ({#, # 0, # 0} &@id[[1]])]


Note for wicked users:Yes, I always store my photos in Excel.

-
There are many functions that generate RGBColor[r,g,b] and these can often be helpful even for purposes such as this. Blend figures out the correct red, green, and blue components and then I extract them using a rule, putting them into the required format {r,g,b}.
Another thing worth noting is that I use an anonymous function that I give that property Listable so that it is applied on all elements of the matrix automatically.
col = Function[x, Blend[{Red, Black}, x] /. RGBColor[r_, g_, b_] :> {r, g, b}, Listable];