Category Archives: Grayscale GLCD

GLCD Font Generator : SVG Vector Graphics Fonts output

Update V4.3

To get GLCD fonts with better antialiasing rendering quality, in apps with grayscale TFT displays (256 gray shades) Bitmap2LCD can output Scalable Vector Graphics (SVG fonts)


About the Sitronix ST7528 grayscale GLCD

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems.

Bitmap2LCD V2.1b and upwards supports the Sitronix ST7528 grayscale GLCD

The Sitronix ST7528 is a 16-Grey Scale Dot Matrix LCD Controller/Driver

< Quote >

The ST7528 LCD controller does not address rows directly, but rather groups of 8 rows in pages. The LCD memory on the controller is organized into 13 8-bit pages and 160 four-bit column addresses.

There are commands to set the starting page address and column address for a write operation, but no commands to select a row address – you must determine what page the row you want to write is in and set the page address that includes that row. This also implies that if you want to write pixels on adjacent pages, you must address the first page and column(s), write the data, then increment the page address to write the pixels in the adjacent page.

The controller also happens to use what seems like a very bizarre way to load pixel data. Logically, once the address is set, you would write the 4-bit pixel data (or maybe write 2 pixels at a time with a single byte). However, since the addressing scheme addresses pages and not rows, this approach is not used.

Instead, one bit of data for the entire addressed column of pixels (8 vertical pixels) in the current page is written with each byte sent to the LCD. Since each pixel requires 4 bits of data to define the grayscale level, 4 bytes of data must be sent per column to fully define the bits. While this data is being clocked in, the “main” column address does not change. Only after the fourth bit is written to a column is the main column address pointer automatically incremented inside the LCD controller so the next 4 bytes of data sent to the LCD will write the bit data for the next column.

To be complete, we must comment that the “column address” that you send to the LCD controller is actually bits 9:2 of a larger column address inside the controller. The bottom two bits 1:0 are “internal column” address bits. When the 4 bytes of data are written to the LCD controller by the MCU, the internal column address bits increment after each byte write. After the fourth byte is sent, the internal bits will roll from b’11’ to b’00’ and subsequently increase bit 2 of the column address. As you can probably guess, if you do not write LCD data to the controller in groups of 4 bytes, than you will not have complete data for the pixels and the internal LCD addressing will be corrupt.

The implication of all this is that you cannot ever write a single pixel on this LCD. The smallest number of pixels that can be refreshed is a 1 column x 8 row line and it will always take a minimum of four bytes sent to the LCD controller from the MCU to properly set those pixels. If you really do only want to update one pixel in the 1×8 column, you must be sure to write the same data that is already present for the other 7 pixels so their information does not change. This is where keeping a local copy of all pixel data in the LCD RAM becomes essential as individual pixels can be changed in the local RAM as the application requires it, and pixel data for unchanged pixels will still be present for the LCD refresh…

< End of Quote >

Quote from this well written Application Note :  ST7528 Appnote

From Bitmap2LCD Version 3.0H

  • Enable the Special Mode (blue arrow) for ST7528 in the Output+Settings main menu
  • To check it out, just draw 8 pixels in height in the work canvas, in one of the gray colors to be found inside the color picker ( in this example the chosen color is 7 )  ( red arrow )
  • Export Work Canvas to data array 
  • Find your 8 pixels inside the data array, 4 x 0x77 , corresponding to the these 8 gray pixels ( green arrow )

When converting a picture into hex data for a graphic LCD of 160 x 100 pixels , you will get 8320 Bytes, in vertical slices of 8 pixels in height.  ( Normal Gray 4bpp Mode outputs slices of 2 pixels in height = 8000 bytes of data )


Before Bitmap2LCD Version 3.0H

Here’s the needed configuration of Bitmap2LCD for a data output for the ST7528 :

  • Enable the Special Mode (red Arrow) for ST7528 in the Output main menu
  • Select the correct data direction (blue arrow)
  • Enable the Special Mode ON/OFF Switch (green arrow)
  • Select 4bpp Grayscale Mode in the Mode main menu

When converting a picture into hex data for a graphic LCD of 160 x 100 pixels , you will get 8320 Bytes, in vertical slices of 8 pixels in height.  ( Normal 4bpp Mode outputs slices of 2 pixels in height = 8000 bytes of data )

Other special Modes for the following Sitronix LCD controllers are planed in future upgrades :

4-Gray Graphic : ST7541 , St7571

32-gray Graphic : ST7529 , ST7586

Bitmap2LCD : Shades of Gray

Bitmap2LCD is a software tool for programming small Graphic LCDs in embedded systems and a programmable text and graphic processing tool.

Shades of Gray

Update V3.7c

Bitmap2LCD can generate data array for Graphic LCD of  4 , 16, 32 and 256 shades of gray

There are several setting options in the Output + Settings Main menu to do this, as shown below :



Here are the color pickers in the 32, 4 and 16 shades of gray modes :

Bitmap2LCD Grayscale Color Pickers

For example, in the 32 gray levels mode, the shades between the white color to the black color will output data per pixel from 0 to 31 decimal , or the opposite, from 31 to 0 decimal, see the above blue arrow if you invert the Gray Shades Palette of the Color Picker and Data Palette of the tool.


Grayscale Palettes

RGB (Red,Green,Blue) values in Hexadecimal :

4 Gray Shades Palette :

000000 555555 AAAAA FFFFFF

16 Gray Shades Palette :

RGB = 000000, 111111, 222222, 333333 until  FFFFFF

32 Gray Shades Palette :

RGB = FFFFFF, F7F7F7, EFEFEF, E7E7E7, DFDFDF, D7D7D7 , CFCFCF, C7C7C7,BFBFBF, B7B7B7, AFAFAF, A7A7A7, 9F9F9F, 979797,8F8F8F, 878787, 7F7F7F, 777777, 6F6F6F, 676767, 5F5F5F, 575757, 4F4F4F,474747, 3F3F3F, 373737, 2F2F2F, 272727, 1F1F1F, 171717, 0F0F0F, 000000



Bitmap2lcd : Dithering and Color Reduction

Dithering and Color Reduction

Bitmap2LCD is a software tool for programming small Graphic LCDs in embedded systems and a programmable text and graphic processing tool.

List of Dithering Algorithms in Bitmap2LCD

When you convert a color image to monochrome or grayscale, you can use one of these algorithms :

Floyd Steinberg, Nearest Color, Stucki, JaNuNi, Steve Arche, Sierra, Burkes.

About Dithering Algorithms

Inside the WORK CANVAS, a graphic on the FLOATING SELECTED LAYER can be dithered (blue arrow) according to the defined parameters above the arrow.

Bitmap2lcd Dithering Algorithms

When a color graphic is imported and should be converted to black and white,  the DITHERING button ( green arrow ) appears at the top of the WORK CANVAS



Generating 2bpp grayscale data on two pages

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems and a programmable graphic and text processing tool.

Generating 2bpp grayscale data on two pages

From Version 3.4b, a new setting for an alternative output format for 2bpp grayscale has been implemented.

The data then is generated in two separate data arrays (or pages) : The first page of 1bpp data is to turn on light gray, and the second page of 1bpp data is to turn dark gray.

For example, for a 128 x 96 2bpp gray LCD Panel, the generated data is split in two arrays of 128 x 12 bytes. Each byte contains 1bpp of 8 pixels, combined with the other byte in the other array to make the 2bpp.

Target : For example LCD controller S6B0741 (Samsung)

bitmap2lcd 4bpp grayscale

Grayscale GLCD controller support : 4,16 and 32 gray levels

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems.

Since V2.3 and upwards, Bitmap2LCD supports the 4,16 and 32 level grayscale controllers. ( Newly implemented are the 4 and 32 gray levels capability )

Color images and pictures can be imported and converted to 4, 16 and 32 gray levels into the work canvas. The software tool then generates the pixel data array in the selected arrangment, 2, 4 or 5 bits per pixel.

Here’s a list of grayscale LCD controllers, featuring 4, 16 and 32 gray levels.


Grayscale LCD Controllers

4 Gray Levels (2bpp)


S6B0741 128×129 Samsung


KS0741 128×129 Samsung


HT1647 64×16 Holtek


ST7541 128×129 Sitronix


ST7571 128×129 Sitronix


ST7586S 384×160 Sitronix


UPD16686 128×128 NEC


UPD16498 128×128 NEC


UPD16488A 128×92 NEC


HD66750 128×128 Hitachi


HD66421 160×100 Hitachi


EM65100 69 x101 Elan Microelectronics Corp


NJU6680 128×128 New Japan Radio


NJU6682 160×132 New Japan Radio


RA8806 320X240 Raio Technology


16 Gray Levels (4bpp)


EM65101 128×160 Elan Microelectronics Corp


SSD1322 480×120 Solomon Systech


SSD1325 128×80 Solomon Systech


SSD1326 256×32 Solomon Systech


SSD1327 128×128 Solomon Systech


32 Gray Levels (5bpp)


ST7529 255×160 Sitronix


Grayscale GLCD >> 16 gray levels basics

Bitmap2LCD is a universal programming tool for converting bitmaps/images to GLCD for most graphic LCD controllers.

This software tool can be used for programming embedded systems connected to a Grayscale Small Graphic LCD ( OLED ) with a built-in COG LCD controller similar to the ST7528.

For a start, here’s a short article about 4bpp grayscale (4-bits per pixel ) for displaying 16 levels of gray.

The values from 0  through 15 decimal (00 to 0F hex) correspond to lightest (white) through darkest (black) as shown in the representation below.

A single byte in the DDRAM can be used to store 2 pixels of information.

When using a module with an on glass ST7528 LCD controller, in the source code data byte, the first pixel data comes after the second pixel data :  22221111

With bitmap2LCD [from v2.0 upwards] you can set ON the automatic pixel data nibble swapping, for a correct ordering in the source code output.