Unofficial Nextion/TJC User Forum

Change picture in compiled TFT

#1

Hi All,

does anyone know something about the compiled TFT files?

My plan is to change i.e. a picture in an already compiled TFT file.

Lets say i have 2 identical TFT files, one has just another picture number 1.

When i compare the content of the compiled files, it is not just this array which is different, almost everythig is different.

so the compiler looks like doing always unique files and it is not possible just to change lets say byte 2000 to byte 4000

ok, i just checked with notepad++ but now when i write this i remember years ago, i had to change parts in an compiled .exe file in hex editor, i will compare in hex and hopefully there it is possible.

I hope i could explain what i try to do :slight_smile:

Thanks,
Alex

#2

OK so i did a Hex-Compare.

It looks like it is exact the same TFT file, just the space where the picture is located in the compiled file has changed.
No Checksum at the end or somewhere else.

Picture is 3.5 inch 480x320 pixel.

The size of the picture in compiled TFT file is ‭307.200‬ Bytes if i am right.
So it has 2 Bytes per pixel.

After checking some BMP Files, it is 16 Bit BMP Format.

Cool, so i will play around, but it is not so complicated as i thought :slight_smile:

When manipulating this byte array it gives me an error :frowning:
Hopefully i will find out how it can work.

EDIT:
Damn, the last 4 Bytes are checksum :frowning:

#3

I’m pretty sure the checksum is a checksum of all the resources (fonts, images, etc.) contained in the TFT-file. The TFT-file contains a virtual file system with an index of all the resources and their location in the file. I’ve been looking into making a resource editor, but it’s such a mess that I don’t think I’ll ever have the time and drive to do it. There are also subtle differences for the different screen models because they have different supported features.

#4

I understand.

But the display itself is doing a checksum check and says data invalid or something else after uploading a “manipulated” TFT File.
So there must be a “simple” calculation, but i could not find out how it is done :frowning:

All i want to do is to replace one fixed space (a picture) inside the TFT file which is not hard, the pictures are more or less in “cleartext” stored. Byte by Byte color.

I need to create a kind of program which checks all bytes in the TFT file except the last ones which includes the checksum and compare it.
Maybe i will have luck someday :slight_smile:

#5

Well, yeah, it is “just” a calculation. It’s a CRC checksum to be exact. But for some reason, there are even multiple versions of the CRC routine depending on which display it is. Seriously, it’s a complete mess.

#6

ok thanks :slight_smile:
For me 3.2 and 3.5 inch nextions would be great.
I tried to find out how it works, just use an empty HMI File with one fullscreen picture.
White and Black.
That means 00 00 00 for black color at the picture position and FF FF FF … for White.
So far so good, 320x240 pixel and 480x320 is fine, the position is clear.
But the checksum is not clear, do i have to take all Bytes of the TFT file except the different onces at the end of the file to get the checksum bytes at the end?
Easy for someone witch checksum knowledge but i have to learn that now :slight_smile: