Displaying Grayscale Image with SSD1327

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tinkrbelle
 
Posts: 2
Joined: Tue Mar 09, 2021 5:04 pm

Displaying Grayscale Image with SSD1327

Post by tinkrbelle »

Hi! I'm having issues with displaying an image array to the 1.5" 128x128 Grayscale OLED display (SSD1327). I'm using a QTPy connected to the display via Stemma QT. The Adafruit_GFX library has the drawGreyscaleBitmap() command, and it gives the best output so far, but it displays it tiled twice in the top half with a bar of noise below.

Code: Select all

display.drawGrayscaleBitmap(0,0, zuko ,128, 128); // zuko: array name 


I've tried various widths and heights, which give pretty funky results too. I know it's not the array that is the problem, as I've made sure it's 4-bit and 16-level and have created 1-bit arrays with the same converter that display fine with drawBitmap(). drawGreyscaleBitmap() is the only way I can get around the 'color' input, but in the library description of the function it says it's for 8-bit displays, which I'm sure is the problem. Any way I can get around this? I've attempted Adafruit_ImageReader, but that was a more complicated process I'd like to avoid.

I'd appreciate any help

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Displaying Grayscale Image with SSD1327

Post by mikeysklar »

I see in the guide that this is a 4-bit greyscale display.
This display, being 16-level (4-bit) grayscale and 128x128 requires 128 * 128 * 4 bits = 8KB of SRAM to buffer.
https://learn.adafruit.com/adafruit-gra ... g-and-test

When running the example code from the SSD1327 github archive do you have any issues with garble? I do see a YPOS starting at 1 and not 0 for what that is worth. It also looks like the code is careful to use 0-127 for the height/width and not go passed that range.

https://github.com/adafruit/Adafruit_SS ... 7_test.ino

User avatar
tinkrbelle
 
Posts: 2
Joined: Tue Mar 09, 2021 5:04 pm

Re: Displaying Grayscale Image with SSD1327

Post by tinkrbelle »

mikeysklar wrote:When running the example code from the SSD1327 github archive do you have any issues with garble? I do see a YPOS starting at 1 and not 0 for what that is worth. It also looks like the code is careful to use 0-127 for the height/width and not go passed that range.
The example code works without a problem. Also, the photo prints legibly, as seen below and the YPOS and height and width are okay when used for the standard drawBitmap() with a black and white array of the same size.

Here's a pic to show the problem better. I still think it's the 4-bit to 8-bit issue, as half the bytes per pixel that the function requires may be causing the doubling somehow? (ignore the diagonal stripes, not seen in real life.)
Image printed to display
Image printed to display
File_000-min.jpeg (856.41 KiB) Viewed 1033 times

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Displaying Grayscale Image with SSD1327

Post by mikeysklar »

Thank you for the photo.

I see the confusion, but won't be much help with this one. The display is 4-bit grayscale and everything I see about the drawGrayscaleBitmap() claims to be for 8-bit display devices so as you suggested this is unclear. There are also 4 different ways to call drawGrayscaleBitmap():

http://adafruit.github.io/Adafruit-GFX- ... c64c69ab80

I think it would be good to get to the source and open an issue on the Adafruit_GFX github repo with the drawGrayscaleBitmap vs drawBitmap behavior you are seeing.

https://github.com/adafruit/Adafruit-GFX-Library/issues

User avatar
venice
 
Posts: 1
Joined: Tue Sep 14, 2021 2:44 pm

Re: Displaying Grayscale Image with SSD1327

Post by venice »

Hi,
I forked and modified the SSD1327 Adafruit Library to use it with an SSD1322 OLED (256x64 Pixel) which has 16 Grayscale levels as well.
Beside the Hardware specific modifications I implemented an function to draw a 4-Bit Grayscale Picture into the Display "Buffer" as I had the same issue as on the photo above.
You can actually draw only a Fullsize Picture (256x64 Pixels, 8192 bytes) but the library is still WIP.
Tested with the SPI Interface and an ESP32 (TTGO T8 v1.7.1)
gng_grayscale.png
gng_grayscale.png (116.66 KiB) Viewed 919 times
Maybe something for you?

You can find the actual version of the SSD1322 Library here:
https://github.com/venice1200/SSD1322_for_Adafruit_GFX

Here is the function to draw an PROGMEM based Bitmap Array (8192 bytes) into the buffer:

Code: Select all

void Adafruit_SSD1322::drawFullsizeGrayscaleBitmap(const uint8_t bitmap[]) {
  //uint8_t *ptr = buffer;
  for (int i=0; i<8192; i++) {
    uint8_t *ptr = &buffer[i];
    *ptr=(uint8_t)pgm_read_byte(&bitmap[i]);
  }
}
You need to run "display" after this command.

If Adafruit finds this SSD1322 Library useful I am happy to give/move my code to the Adafruit Code World.

Tags: 1322 Oled 1327 Grayscale

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”