lvgl / lv_utils

Convert images or system fonts to C arrays. Written for LVGL embedded GUI library
https://littlevgl.com
54 stars 38 forks source link

Colors inverted between online tool and offline tool with indexed_4 / 16 colors #33

Closed kidonsky closed 4 years ago

kidonsky commented 4 years ago

Differents results between online tool and offline tool with indexed_4 / 16 colors

Details

With same image and options (indexed_4 offline is equivalent to Indexed 16 colors online and c_array) with online tool I got a background of 0xff which is normal but with offline tool I got a background of 0x11.

0x00 do not move all other values are inverted. Pixels are not the same see example at the end of message

Line used on CLI :

php img_conv_core.php "name=image&img=image.png&cf=indexed_4"

Thanks


Example

These are 3 lines extracted of the converted files :

kidonsky commented 4 years ago

Palettes are different too. Can be related ?

From web converter :

  0x04, 0x02, 0x04, 0xff,   /*Color of index 0*/
  0x89, 0x88, 0x89, 0xff,   /*Color of index 1*/
  0x48, 0x48, 0x48, 0xff,   /*Color of index 2*/
  0xc8, 0xc8, 0xc8, 0xff,   /*Color of index 3*/
  0x27, 0x26, 0x27, 0xff,   /*Color of index 4*/
  0xa8, 0xa8, 0xa8, 0xff,   /*Color of index 5*/
  0x68, 0x68, 0x68, 0xff,   /*Color of index 6*/
  0xe9, 0xe8, 0xe9, 0xff,   /*Color of index 7*/
  0x18, 0x18, 0x18, 0xff,   /*Color of index 8*/
  0x9a, 0x9a, 0x9a, 0xff,   /*Color of index 9*/
  0x5a, 0x5b, 0x5a, 0xff,   /*Color of index 10*/
  0xd8, 0xd8, 0xd8, 0xff,   /*Color of index 11*/
  0x37, 0x37, 0x37, 0xff,   /*Color of index 12*/
  0xb7, 0xb8, 0xb7, 0xff,   /*Color of index 13*/
  0x78, 0x78, 0x78, 0xff,   /*Color of index 14*/
  0xfc, 0xfd, 0xfc, 0xff,   /*Color of index 15*/

From offline converter :

  0x00, 0x00, 0x00, 0xff,   /*Color of index 0*/
  0xff, 0xff, 0xff, 0xff,   /*Color of index 1*/
  0xfd, 0xfd, 0xfd, 0xff,   /*Color of index 2*/
  0xf9, 0xf9, 0xf9, 0xff,   /*Color of index 3*/
  0x02, 0x02, 0x02, 0xff,   /*Color of index 4*/
  0x0e, 0x0e, 0x0e, 0xff,   /*Color of index 5*/
  0xd0, 0xd0, 0xd0, 0xff,   /*Color of index 6*/
  0x23, 0x23, 0x23, 0xff,   /*Color of index 7*/
  0xe9, 0xe9, 0xe9, 0xff,   /*Color of index 8*/
  0x5d, 0x5d, 0x5d, 0xff,   /*Color of index 9*/
  0x35, 0x35, 0x35, 0xff,   /*Color of index 10*/
  0x72, 0x72, 0x72, 0xff,   /*Color of index 11*/
  0xb4, 0xb4, 0xb4, 0xff,   /*Color of index 12*/
  0x4b, 0x4b, 0x4b, 0xff,   /*Color of index 13*/
  0xa2, 0xa2, 0xa2, 0xff,   /*Color of index 14*/
  0x8f, 0x8f, 0x8f, 0xff,   /*Color of index 15*/
kisvegabor commented 4 years ago

And which one is correct?

kidonsky commented 4 years ago

The result given by online tool is the correct one.

kisvegabor commented 4 years ago

I've diffed the source files and they are the same. It seems there is a difference in some functions across php versions.

On the website I use PHP 7.2.6

kidonsky commented 4 years ago

Ok, my fault I did not thought about that. I am on Fedora 31 and only php7.3 is available on classic package manager.

Indeed with php7.2 is working good.

Thank you, for your time and help.

embeddedt commented 4 years ago

That's not good if it's breaking with a newer PHP version. I would expect it to only be broken with older versions.

kidonsky commented 4 years ago

Note, php7.2 is not anymore on some package managers. Fedora 31 but also Ubuntu 19

I think that it should be corrected.

kisvegabor commented 4 years ago

I can change the PHP version to PHP7.3.6 on the server. But I am afraid of what error might it cause. If this color inversion was introduced other errors might happen too.

stale[bot] commented 4 years ago

This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.