if gr.Monochrome then begin
      for y := 1 to 16 do begin
        for x := 0 to 3 do begin
          i := 0;
          with gr.Canvas do begin
            if (Pixels[y,x*8 + 1]=clBlack) then i := i + 128;
            if (Pixels[y,x*8 + 2]=clBlack) then i := i + 64;
            if (Pixels[y,x*8 + 3]=clBlack) then i := i + 32;
            if (Pixels[y,x*8 + 4]=clBlack) then i := i + 16;
            if (Pixels[y,x*8 + 5]=clBlack) then i := i + 8;
            if (Pixels[y,x*8 + 6]=clBlack) then i := i + 4;
            if (Pixels[y,x*8 + 7]=clBlack) then i := i + 2;
            if (Pixels[y,x*8 + 8]=clBlack) then i := i + 1;
          end;
          Result := Result + IntToHex(i,2);
         end;
      end;
    end else begin
      for y := 1 to 16 do begin
        for x := 0 to 3 do begin
          i1 := 0;
          i2 := 0;
          case gr.Canvas.Pixels[y,x*8 + 1] of
            clRed:    i1 := i1 + 128;
            clGreen:  i1 := i1 + 128;
            clYellow: begin 
                        i1 := i1 + 128; 
                        i2 := i2 + 128; 
                      end;
          end;
          case gr.Canvas.Pixels[y,x*8 + 2] of
            clRed:    i1 := i1 + 64;
            clGreen:  i1 := i1 + 64;
            clYellow: begin 
                        i1 := i1 + 64; 
                        i2 := i2 + 64; 
                      end;
          end;
          case gr.Canvas.Pixels[y,x*8 + 3] of
            clRed:    i1 := i1 + 32;
            clGreen:  i1 := i1 + 32;
            clYellow: begin 
                        i1 := i1 + 32; 
                        i2 := i2 + 32; 
                      end;
          end;
          case gr.Canvas.Pixels[y,x*8 + 4] of
            clRed:    i1 := i1 + 16;
            clGreen:  i1 := i1 + 16;
            clYellow: begin 
                        i1 := i1 + 16; 
                        i2 := i2 + 16; 
                      end;
          end;
          case gr.Canvas.Pixels[y,x*8 + 5] of
            clRed:    i1 := i1 + 8;
            clGreen:  i1 := i1 + 8;
            clYellow: begin 
                        i1 := i1 + 8; 
                        i2 := i2 + 8; 
                      end;
          end;