I put my Nextion display in a box and then I realized that I could no longer get to the connector. So I made an option in a menu to turn my Arduino Uno in pass-through mode. That way I can use the Nextion Editor on my computer and upload it via the Arduino Uno to the display.
Using a Arduino Uno with AltSoftSerial to the Nextion display at 38400 baud, which is very slow to upload. After that I have to reset the Arduino.
while( true)
{
if( Serial.available())
nexSerial.write( Serial.read());
if( nexSerial.available())
Serial.write( nexSerial.read());
}
But perhaps that is not about your question.
If you have a ESP32 or a Arduino with a SD card and want to upload a image, then you should look at the instruction set: https://nextion.tech/instruction-set/.
If it is not in the instruction set, then it has not been made public.
I do not fully understand the instruction set. It has cryptic notes, such as: "should be skipped if not fully understood".