How to Show BMP Convert .c MCUFriend 3.5 inch TFT

3.95 tft display ,if i need to show BMP file from ImageConverter 565 how to setting. in void loop

this in void loop but show picture scrambled.

tft.setAddrWindow(wid - 240 - 40, 20 + 50, wid - 1 - 100, 70 + 83 - 1);
tft.pushColors(VS_Chem10083, 8300, 1);

my picture size 100x83

in UTFTGLUE.h i don't what is this sx and sy

MCUFRIEND_kbv::setAddrWindow(x, y, x + sxscale - 1, y + syscale - 1);
if (scale == 1) MCUFRIEND_kbv::pushColors((const uint8_t*)data, sx * sy, 1);

and why can't use drawBitmap T_T

I provide a "drawBitmap_kbv" example that shows raw bitmaps. Both monochrome and colour.
Most of the images use GFX methods. You can use with any Adafruit_GFX style graphics library.

UTFTGLUE is not designed for new programs. It is just provided as a help for legacy UTFT programs.
Quote which UTFT example does not work.

Please post your code if you want help. I am only prepared to help with legacy UTFT programs that work with current UTFT.

David.

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

#include <SPI.h>         
#include "Adafruit_GFX.h"
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

//#include "VS_Chem200x166.c"

#define  BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

//extern const unsigned char PROGMEM penguin[];

void setup(void) {
    Serial.begin(9600);
//    tft.reset();                 //hardware reset
    tft.begin(0x9481);
    tft.setRotation(1);
}


void loop(void) {
  uint16_t dx, rgb, n, wid, ht;
  wid = tft.width();  // 480
  ht = tft.height();  // 320
  
  Serial.print("wid: ");
  Serial.println(wid);
  Serial.print("ht: ");
  Serial.println(ht);
  
  extern const uint8_t penguin[];
  extern const uint8_t VS_Chem10083[];
  extern const uint8_t VS_Chem4033[];
  
  tft.fillScreen(BLACK);
  tft.setCursor(30, 90);
  tft.setTextColor(GREEN);
  tft.setTextSize(14);
  tft.println("Group");
  
  tft.setAddrWindow(wid - 240 - 40, 20 + 50, wid - 1 - 100, 70 + 83 - 1);
  tft.pushColors(VS_Chem10083, 8300, 1);
  delay(5000);

}

Code and .c in file zip

thank you

Graphictest_PH.zip (62.7 KB)

You seem to be struggling. Try this (on something bigger than a Uno). Show less images on a Uno.

#include "Adafruit_GFX.h"
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

extern const uint8_t penguin[];
extern const uint8_t icon_40x40[];
extern const uint8_t VS_Chem10083[];
extern const uint8_t VS_Chem4033[];

void showImage565(int x, int y, int w, int h, const uint8_t img[])
{
    tft.setAddrWindow(x, y, x + w - 1, y + h - 1);
    tft.pushColors(img, w * h, 1);
}

void setup(void)
{
    uint16_t ID = tft.readID();
    if (ID == 0xD3D3) ID = 0x9481;
    tft.begin(ID);
    tft.setRotation(1);   //Landscape
}

void loop(void)
{
    tft.fillScreen(TFT_BLACK);
    tft.setCursor(30, 90);
    tft.setTextColor(TFT_GREEN);
    tft.setTextSize(14);
    tft.println("Group");

    showImage565(100, 5, 100, 83, VS_Chem10083);
    showImage565(250, 10, 40, 33, VS_Chem4033);
    showImage565(300, 15, 40, 40, penguin);
    showImage565(350, 20, 40, 40, icon_40x40);
    delay(5000);
}

Your images look horrible. Please post a link to the original JPEG or PNG artwork.

I note that they seem to use only two colours. So you could actually use the GFX methods to print each colour transparently. Monochrome images take up very little Flash memory.

Note how a simple "helper function" makes life much more easy.

David.

This Original Picture , how to show big photo if convert picture to large picture it fail compile size of array 'VS_Chem200x166' is too large

Graphictest_PH.zip (62 KB)

I opened VS_Chem.png with IrfanView. Resized it to 100x83 pixels. Saved as a JPG file.

Then used ImageConverter565 to create the C file from the 100x83 JPG.

I created another C file by using ImageConverter565 to reduce the 954x794 PNG before creating another C file.

Actually, both of these methods work reasonably well.

I displayed all three images together on a ILI9341 screen. Your VS_Chem10083[] looks horrible. My VS_Chem10083_1[] and VS_Chem10083_2[] look reasonable.

However, if you look at original artwork in IrfanView you can see the difficulties. The thin white border is why your image has random white pixels. The Blue lettering is difficult to read.
Some Artwork is better suited to printed paper and others to electronic displays.

I suggest that you experiment with different sized images. An image bigger than 100x83 might look better. 120x100 looks quite nice. If your C array is more than 16384 pixels you have to store in two arrays.

David.

Edit. I see your problem. From your C file

// Generated by  : ImageConverter 565 v2.2
// Generated from: VS_Chem.png
// Time generated: 30/9/2561 3:04:51
// Dimensions    : 100x83 pixels
// Size          : 16,600 Bytes

Which planet and what time domain do you live in?

My C files are generated from v2.3 (which came with the current UTFT v2.8.2)

// Generated by  : ImageConverter 565 v2.3
// Generated from: VS_Chem-2.png
// Time generated: 01-Oct-18 20:57:15
// Dimensions    : 100x83 pixels
// Size          : 16,600 Bytes

Work Thank you Sir

How did you produce your original C file?
Was it just an OLD version of ImageConverter that does not reduce very well?

I still think that you might tweak your colours in IrfanView to get the best looking image on the TFT.

Do you see how a "helper function" makes it easy to position an image?

David.