How to show a bitmap on OLED display(128x64) from SD card

Can anyone help me how to show a bitmap on OLED display(128x64) from SD card.
I have tried the code which is below but the image is scattered.

#include <Wire.h>
#include <OzOLED.h>
#include <SD.h>
#define SIZE 128*64/8

char buf[SIZE];


File root;
File myFile;

void setup(){
Serial.begin(9600);
 
  if (!SD.begin(53)) {
    Serial.println("Initialization Failed");
    delay(3000);
    return;
  }else{
  Serial.println("Initialization OK");
  delay(3000);
    }
  myFile = SD.open("OLED.H");
    OzOled.init();  //initialze Oscar OLED display
  
}

void loop(){
  OzOled.clearDisplay();      // clear the screen and set start position to top left corner
  

  if  (myFile && myFile.available()) {
    myFile.read(buf, SIZE);
  } else {
    myFile.close();
    myFile = SD.open("OLED.H");
    Serial.println("Replay.");
    //delay(10);
  }
 OzOled.drawBitmap((const uint8_t*)buf, 0, 0, 16, 8);

}

OLED.H File :

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0,
0xF8, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0x3F, 0x1F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x01,
0x01, 0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8,
0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xE0, 0xF0, 0x10, 0x18, 0x08, 0x08, 0x08,
0x18, 0x38, 0x70, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0x3C, 0x0E, 0x0F, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x3C, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xC0, 0x83, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x80, 0xE0, 0x78, 0x1F, 0x37, 0x38, 0xBC, 0xFC, 0xE4, 0x80, 0x00, 0x00, 0xE0, 0xF0, 0x38, 0x28,
0xB8, 0x98, 0x80, 0xC0, 0xE0, 0x30, 0x18, 0x88, 0xC8, 0xF8, 0xB8, 0x80, 0x3C, 0x3C, 0xEC, 0xF8,
0x98, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x1F, 0x01, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xE0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xE0, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xE0, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0x7E,
0x7E, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xF0, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60,
0x60, 0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F,
0xFF, 0x8F, 0x07, 0x07, 0x03, 0x01, 0x01, 0x01, 0x00, 0xF0, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF8, 0xFC, 0xFC, 0x00, 0x01, 0x01, 0x03, 0x03, 0x07, 0x0F, 0xDF, 0xFF,
0x7F, 0x7F, 0x3F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0x7E, 0x1F, 0x07, 0x01, 0x00,
0x04, 0x06, 0x03, 0x81, 0xE0, 0x6C, 0x0C, 0x04, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x20, 0x20, 0xE0,
0xE0, 0x00, 0xD0, 0xF0, 0xE0, 0x60, 0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x60, 0x20,
0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x0F, 0x3C, 0x70, 0x60, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x83, 0x83, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x81, 0x83, 0x83, 0x80, 0xC0, 0xC0, 0xC0, 0x60, 0x30, 0x1C, 0x0F, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x06, 0x07, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x00, 0x07, 0x07, 0x04, 0x06, 0x02, 0x00, 0x07, 0x07, 0x04, 0x04, 0x06, 0x07, 0x07,
0x06, 0x06, 0x07, 0x03, 0x00, 0x06, 0x07, 0x05, 0x06, 0x02, 0x80, 0x87, 0x87, 0x04, 0x84, 0xF6,
0xFF, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x02, 0x02, 0x03, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

Thanks.

I have no idea what "ozOLED.h" might be. It is not available via the Library Manager.

However there are plenty of proven OLED libraries from the Library Manager e.g. Adafruit_SSD1306

I assume that your "ozOLED.h" is an Adafruit_GFX style library and has:

    drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
      int16_t w, int16_t h, uint16_t color),
    drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
      int16_t w, int16_t h, uint16_t color, uint16_t bg),
    drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
      int16_t w, int16_t h, uint16_t color),
    drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
      int16_t w, int16_t h, uint16_t color, uint16_t bg),

The first two methods will draw the Bitmap from PROGMEM memory.
The last two methods draw from SRAM memory.

Since you are reading from SD card into SRAM, you should use one of the last two methods. e.g.

 OzOled.drawBitmap((uint8_t*)buf, 0, 0, 16, 8);

Life is much simpler if you store monochrome bitmaps in PROGMEM. You can get several in UNO Flash. Since you appear to have a MEGA2560, you can store a massive number of bitmaps in Flash.

Full Colour BMP files that you might display on a TFT or Colour OLED are very BIG. Too big for a Mega2560. You can store these on an SD card.

David.

Thanks David, I have Adafruit_SSD1306 library too. Can you help me to change the code and prepare a full working code for me? Please. I will thankful to you.

My apologies. Your "drawBitmap()" is a different style to the regular Adafruit_GFX drawBitmap() for monohrome bitmaps.

Here is an example in the attachment.

There are many PC apps and web apps that can convert a BMP or JPEG into a suitable bitmap like my "tractor_128x64.h" file.

David.

OLED_Atharvak.zip (2.84 KB)

Hi David, your code works great! Now can you tell me how can I display that bitmap from SD card?

I want Arduino to read this bitmap code from SD card and display it on OLED (i2c).

What file format do you want on your SD card?

Are you going to produce the files?
Or do you have to display existing files?

BMP files can be made on a PC. They can be monochrome or full colour. They contain size, shape, colour palette, ... information. So you can display anywhere. The files are BIG.

You can produce a RAW binary file e.g. just store the contents of my PROGMEM array on disk.
Then read the disk into SRAM. Use the SRAM version of the drawBitmap() method.

The RAW binary file has no information about the geometry. You have to "know".

Seriously, your 128x64 OLED does not have a SD card. Your MEGA2560 has lots of Flash memory.

David.

I want ".h" file format on my SD card. eg: File.h

I have to display existing files.

In that SD card module, that File.h contains data of raw Bitmap i.e. const uint8_t File[1024] PROGMEM = { 0x00,0x00,....};

It should be displayed on OLED Screen(i2c 128x64) from SD Card.

Hence, Arduino should read this file from the SD card module and display it on OLED Screen.

My MEGA2560 has lots of Flash memory but I want to do it.

Atharva.

This will display a "File.bin" with 1024 bytes of raw data:

#include <Wire.h>                     // required to run I2C SSD106
#include <SPI.h>                      // required to run SSD106 with SPI interface
#include <Adafruit_GFX.h>             // https://github.com/adafruit/Adafruit-GFX-Library
#include <Adafruit_SSD1306.h>         // https://github.com/adafruit/Adafruit_SSD1306

#include <SD.h>
#define SD_CS 53

#define OLED_CLK 13
#define OLED_MOSI 11
#define OLED_RESET 8
#define OLED_I2C_RESET 4
#define OLED_DC 9
#define OLED_CS 10

//Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS); // Hardware SPI
//Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); // Software SPI
Adafruit_SSD1306 display(OLED_I2C_RESET); //  Hardware I2C

#include "oled_buf.h"      //your bitmap
#include "tractor_128x64.h"

void setup()
{

    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // required to run SSD1306
    display.display();                          // show Adafruit logo
    delay(1000);
    bool good = SD.begin(SD_CS);
    if (!good) {
        display.print(F("cannot start SD"));
        display.display();
        while (1);                              //tread water
    }
}

void loop()
{
    uint8_t buf[1024];
    File f = SD.open("File.bin");
    f.read(buf, 1024);          //read whole file into SRAM
    f.close();
    display.clearDisplay();
    // your bitmap is organised for each byte as 8-bit vertical stripe per column
    for (int row = 0; row < 64; row += 8) {
        for (int col = 0; col < 128; col++) {
            uint8_t c = *(buf + (row / 8) * 128 + col);
            for (uint8_t cnt = 0; cnt < 8; cnt++) {
                display.drawPixel(col, row + cnt, (c & 0x01) ? WHITE : BLACK);
                c >>= 1;
            }
        }
    }
    display.display();
    delay(1000);
    // this shows a regular bitmap i.e. horiz stripes
    display.drawBitmap(0, 0, tractor_128x64, 128, 64, BLACK, WHITE);
    display.display();
    delay(1000);
}

If your "File.h" on SD card looks like:

const uint8_t File[1024] PROGMEM = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    ...

You simply put the SD card into your PC. Copy "File.h" to your project directory.
In my original example I had

const uint8_t oled_buf[1024] PROGMEM = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    ...

So you would replace my oled_buf with your File
Note that a name like File is a bad idea. I suggest that you use something like picture_buf or logo_buf

David.

Hi David, I test your code but no success.

Below, I have posted a picture.

All dots can be seen.

David, what format of the file should be? (.bin or .h)

If it is .bin then how to create it.

I have tried with .h format and removed the const uint8_t oled_buf[] PROGMEM = {... and rest all are HEX i.e. 0x00,0x00,...

Either paste your "File.h" into the message or attach the file. I will show you how to display it.

The problem with "raw" files is that you have to guess the format.
If you have a JPG, GIF, PNG, BMP, ... the format is encoded in the first few "header" bytes.

David.

Nothing I have understand.

Go on. You managed to paste the OLED.H data into a code window in your original post.

You do exactly the same with your "File.h" data.

I attached a complete project in #1. Did you unzip it? Did you try it? Did it work?

No one expects you to understand everything. I guess that English is not your native language.

However, you can ask Google to translate into your own language.
And if there is a sentence that you do not understand, quote my difficult sentence in your message.

David.

I am using SD card module.
In the SD card, OLED.H file is there, in which raw data is there.

OLED.H

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0,
0xF8, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0x3F, 0x1F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x01,
0x01, 0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8,
0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xE0, 0xF0, 0x10, 0x18, 0x08, 0x08, 0x08,
0x18, 0x38, 0x70, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0x3C, 0x0E, 0x0F, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x3C, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xC0, 0x83, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x80, 0xE0, 0x78, 0x1F, 0x37, 0x38, 0xBC, 0xFC, 0xE4, 0x80, 0x00, 0x00, 0xE0, 0xF0, 0x38, 0x28,
0xB8, 0x98, 0x80, 0xC0, 0xE0, 0x30, 0x18, 0x88, 0xC8, 0xF8, 0xB8, 0x80, 0x3C, 0x3C, 0xEC, 0xF8,
0x98, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x1F, 0x01, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xE0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xE0, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xE0, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0x7E,
0x7E, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xF0, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60,
0x60, 0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F,
0xFF, 0x8F, 0x07, 0x07, 0x03, 0x01, 0x01, 0x01, 0x00, 0xF0, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF8, 0xFC, 0xFC, 0x00, 0x01, 0x01, 0x03, 0x03, 0x07, 0x0F, 0xDF, 0xFF,
0x7F, 0x7F, 0x3F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0x7E, 0x1F, 0x07, 0x01, 0x00,
0x04, 0x06, 0x03, 0x81, 0xE0, 0x6C, 0x0C, 0x04, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x20, 0x20, 0xE0,
0xE0, 0x00, 0xD0, 0xF0, 0xE0, 0x60, 0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x60, 0x20,
0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x0F, 0x3C, 0x70, 0x60, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x83, 0x83, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x81, 0x83, 0x83, 0x80, 0xC0, 0xC0, 0xC0, 0x60, 0x30, 0x1C, 0x0F, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x06, 0x07, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x00, 0x07, 0x07, 0x04, 0x06, 0x02, 0x00, 0x07, 0x07, 0x04, 0x04, 0x06, 0x07, 0x07,
0x06, 0x06, 0x07, 0x03, 0x00, 0x06, 0x07, 0x05, 0x06, 0x02, 0x80, 0x87, 0x87, 0x04, 0x84, 0xF6,
0xFF, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x02, 0x02, 0x03, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

Please tell me what can i do now ?

I attached a complete project in #1. Did you unzip it? Did you try it? Did it work?

No one expects you to understand everything. I guess that English is not your native language.

Here is a sketch that reads the C array from your H file and writes a BIN file to your SD.

#include <Wire.h>                     // required to run I2C SSD106
#include <SPI.h>                      // required to run SSD106 with SPI interface
#include <Adafruit_GFX.h>             // https://github.com/adafruit/Adafruit-GFX-Library
#include <Adafruit_SSD1306.h>         // https://github.com/adafruit/Adafruit_SSD1306
#include <SD.h>

#define SD_CS 3                       // change for YOUR SD card

#define OLED_CLK 13
#define OLED_MOSI 11
#define OLED_RESET 8
#define OLED_I2C_RESET 4
#define OLED_DC 9
#define OLED_CS 10

//Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS); // Hardware SPI
//Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); // Software SPI
Adafruit_SSD1306 display(OLED_I2C_RESET); //  Hardware I2C

#include "oled_buf.h"      //your bitmap
#include "tractor_128x64.h"

// your weird format bitmap is similar to KS0108 GLCD displays
void drawKS0108map_P(int x, int y, const uint8_t *buf, int w, int h)
{
    for (int row = 0; row < h; row += 8) {
        for (int col = 0; col < w; col++) {
            uint8_t c = pgm_read_byte(buf + (row / 8) * 128 + col);
            for (uint8_t cnt = 0; cnt < 8; cnt++) {
                display.drawPixel(x + col, y + row + cnt, (c & 0x01) ? WHITE : BLACK);
                c >>= 1;
            }
        }
    }
}

bool error(char *msg1, char *msg2)
{
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.clearDisplay();
    display.print(msg1);
    display.print(msg2);
    display.display();
    delay(5000);
    return false;
}

bool write_buf_SD(char *name)
{
    File f = SD.open(name, FILE_WRITE);
    bool good = (f != NULL);
    if (!good) return error("can't open", name);
    if (f.size() >= 1024) error(name, " exists");
    else f.write(display.getBuffer(), 1024);
    f.close();
    return good;
}

bool read_buf_SD(char *name)
{
    File f = SD.open(name, FILE_READ);
    bool good = (f != NULL);
    if (good) {
        f.read(display.getBuffer(), 1024);
        f.close();
    }
    else return error("can not find ", name);
    display.display();
    delay(1000);
    return good;
}

void setup()
{

    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // required to run SSD1306
    display.display();                          // show Adafruit logo
    delay(1000);
    bool good = SD.begin(SD_CS);
    if (!good) {
        error("cannot start SD", "\nstopping here");
        while (1);                              //tread water
    }
    // draw YOUR bitmap in Flash to the internal buffer
    drawKS0108map_P(0, 0, oled_buf, 128, 64);
    display.display();
    // write the buffer to file on SD
    write_buf_SD("oled_buf.bin");
    // same thing but this is a regular format bitmap
    display.drawBitmap(0, 0, tractor_128x64, 128, 64, BLACK, WHITE);
    display.display();
    write_buf_SD("tractor.bin");
}

void loop()
{
    /*
        display.clearDisplay();
        // your bitmap is organised for each byte as 8-bit vertical stripe per column
        drawKS0108map_P(0, 0, oled_buf, 128, 64);
        display.display();
        delay(1000);
    */
    // this shows a regular bitmap from Flash but I have swapped WHITE/BLACK
    display.drawBitmap(0, 0, tractor_128x64, 128, 64, WHITE, BLACK);
    display.display();
    delay(1000);
    // reads and displays bitmap from SD
    read_buf_SD("oled_buf.bin");
    read_buf_SD("tractor.bin");
}

It was PAINFUL to add an SD card to an OLED project. I do everything with Unos. There is not enough SRAM in a Uno for SD and OLED buffer. So I had to run it on a Nucleo.

Seriously, life is much easier with your pictures in Flash memory.

David.