graybar  =  
            Table[{j/256,  j/256,  j/256}, {i, 1, 1},  {j, 1, 256}];
gbar = 
            Graphics[RasterArray[Apply[RGBColor,  graybar, {2}]],  
              ImageSize  ->  {256, 20},  
              AspectRatio -> Automatic];

\(Export\ ["D:\Mathematica\Data\gbar.jpg", \ gbar, \ 
            ImageSize\  -> \ {256, 1}];\)
Show[gbar];

  

hotmap = 
            Table[{
Piecewise[{
{1,  
                      1 <= i < 42}, 
{1, 
                      42 <= i < 84}, 
{Floor[
                        5.8*(i - 83)], 
                      84 <= i < 128}, 
{256, 
                      128  <= i < 170}, 
{256, 
                      170 <= i < 212}, 
{256, 
                      212 <= i <= 
                        256}
}], 
Piecewise[{
{1,  
                      1 <= i < 42}, 
{(i - 41)*6, 
                      42 <= i < 84}, 
{256, 
                      84 <= i < 
                        128}, 
{256 - (i - 128)*6, 
                      128  <= i < 170}, 
{1, 
                      170 <= i < 
                        212}, 
{Floor[(i - 211)*5.7], 
                      212 <= i <= 
                        256}
}], 
Piecewise[{ 
{Floor[i*5.8],  
                      1 <= i < 
                        42}, 
{256 - ((i - 42)*6), 
                      42 <= i < 84}, 
{1, 
                      84 <= i < 128}, 
{1, 
                      128  <= i < 170}, 
{(i - 169)*6, 
                      170 <= i < 212}, 
{256, 
                      212 <= i <= 
                        256}
}]
}, 
{i, 1, 256, 1}];

hotmap[[1, All]] = 1 ;     

  
Export["D:\\Mathematica\\Data\\hotmap.dat", 
              hotmap];

church = 
            Import ["D:\\Mathematica\\Data\\gbar_church_256.jpg"];

(* Note Mathematica ' 
              ImageSize' is given in {width,  height} , unlike a matrix which is row - by - column; note that a displayed matrix row 1 is the bottom row in an image *)

  
Show[Graphics[church],ImageSize->{368, 256}];

  

church  =  
            church  /.  Graphics  ->  List;
\(pv\  = \ church[\([1, 1]\)]; \ \  (*\ 
          extracts\ all\ the\ pixels'\ values\ *) 
size = Dimensions[pv];\)
height =  size[[1]];
width  =  size[[2]];
depth  =  size[[3]];

  

pv1 = 
            Table[{Part[pv, i, j, 1]}, {i, 1, height}, {j, 1, width}];

  

pv2 = Flatten[pv1];

  

numpixs = height*width;
pv3 = Table[{i}, {i, 1, numpixs}];  
        pv3[[All]] = {0, 0, 0};

  

For[i = 1,  
            i ≤ numpixs,  i++, 
            pv3[[i, All]] = 
              hotmap[[(pv2[[i]]  + 1) ]]  /256] ;

  
pv4 = Partition[pv3,  width];

pseudochurch = 
            Graphics[RasterArray[Apply[RGBColor, pv4, {2}]], 
              ImageSize -> {width, height},  
              AspectRatio -> Automatic];    
Show[pseudochurch];

\(Export\ ["D:\Mathematica\Data\pseudochurch.tif", \ pseudochurch, \ 
            ImageSize -> {height, width}];\) 
\(Export\ ["D:\Mathematica\Data\pseudochurch.jpg", \ pseudochurch, \ 
            ImageSize -> {height, width}];\)