0

I'm writing a firmware for ESP32-S3 and a NHD-7.0-800480FT-CSXV-CTP display using this library. As described in another question question to show a JPG image I convert it in C code with xxd -i <image>.jpg | tee output.c | wc -w in order to end up with something like this:

#if !defined(PROGMEM)
    #define PROGMEM
#endif

unsigned char IMG_LOGO[1074] = {
  0x94, 0x4d, 0x03, 0x52, 0x85, 0x61, 0x14, 0x3d, 0x1f, 0x9e, 0x79, 0xff,
  0x97, 0xed, 0x1a, 0x64, 0xdb, 0xf6, 0x20, 0xdb, 0x36, 0xc7, 0x2d, 0xa1,
  0x15, 0xc5, 0x0d, 0x34, 0xca, 0x5a, 0x46, 0xfc, 0x91, 0x6b, 0xd8, 0xb9,
  0x77, 0x74, 0xa8, 0x9e, 0xa9, 0x77, 0xf0, 0x36, 0xd4, 0xd4, 0xd7, 0x80,
  // ...
};

Then I transfer the image to the controller and display it:

#define MEM_IMG 0x000f8000

EVE_init_spi();
EVE_init();

EVE_cmd_loadimage(MEM_IMG, 0, IMG, sizeof(IMG));
EVE_color_rgb(COLOR_WHITE);
EVE_cmd_dl(DL_BEGIN | EVE_BITMAPS);
EVE_cmd_setbitmap(MEM_IMG, EVE_RGB565, 57, 60);
EVE_cmd_dl(VERTEX2F(100 * 16, 100 * 16));
EVE_cmd_dl(DL_END);

Of course adjusting the size and the memory address for each one. The problem is that some JPG work and other won't show at all or are displayed just as "colored noise".

At section 5.19 of the manual above I read:

The image data should be in the following formats: Regular baseline JPEG (JFIF); PNG, except Adam-7 interlaced images. Only bit-depth 8 is supported, bit-depths 1, 2, 4, and 16 are not.

and

For JPEG images, the bitmap is loaded as either a RGB565 or L8 format bitmap, depending on the original image. If OPT_MONO is given, L8 is used.

Let's say I create a new image in GIMP. When I export it in JPEG I have the following options available:

JPEG export options

but I don't see any reference to "Regular baseline JPEG". What should I set in GIMP in order to provide a compatibile JPEG for my display?

For example a JPEG image I've created that renders just as "noise" has these properties:

JPEG properties

6
  • Hi. Welcome to GDSE. I don't think GIMP has this functionality natively. I googled it, and there is a rather old plugin for RGB565 esport here. I haven't tried it though, and I'm not installing something I don't need, so you'd have to test it yourself.
    – Billy Kerr
    Commented Jul 19 at 10:51
  • @BillyKerr, actually the issue arises because some JPEG I downloaded from the web (and converted to C code with the command above) are displayed correcty (even if I opened them in GIMP, resized and exported again) while if I create a new picture from scrath it does not work. And I cannot spot the differences.
    – Mark
    Commented Jul 19 at 12:13
  • I'm failing to see how this is related to graphic design and not simply computer science. While jpg is certainly a common image format used in design, so are office chairs. Asking about chair repair isn't on topic.
    – Scott
    Commented Jul 19 at 13:30
  • Well, but it is about how to use GIMP (or other application) to export an image. If I would post this question on StackOverflow I guess they will close my question since is not programming related. Is there a better StackExchange site?
    – Mark
    Commented Jul 19 at 13:34
  • @Mark - To get a more definitive answer this is something you might want to reach out to the GIMP developers about. I can find nothing that says if GIMP even supports RGB565.
    – Billy Kerr
    Commented Jul 19 at 14:38

1 Answer 1

1

As far as I can tell the opposite of "baseline JPEG" is "progressive JPEG" and Gimp has an option for this (with "Progressive" being the default):

enter image description here

So if you want a baseline JPEG just uncheck it (and you can click "Save defaults" to make it the new default setting).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.