Change picture in compiled TFT

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:


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.

Damn, the last 4 Bytes are checksum :frowning:

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.

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:

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.

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:

Hi, sorry for the delayed response. That is a good way to find the location of the image inside the file, but the location will of course be different for another TFT-file, unless everything else is the same.

Anyway, the resources inside the TFT-file are grouped based on resource type. Fonts, images, videos etc. are grouped together. Every resource group has their own checksum as well as a checksum for all resource groups as a whole. If I remember correctly.

thanks, i still could not figure out where the checksum is :frowning:
OK, not where the checksum is, which range of bytes is used for calc the checksum.

But that has not a high priority, i would just need it for “nice fonts” TFT file (based on newer Nextion Editor than official released), customer can upload the wish-picture and get back a TFT file to update the display.

Nice to have but not a must have, maybe i will have more time one day, then i will check byte by byte (or array) and see which range of bytes gives me back the correct checksum.