PNG tEXt and iTXt Encoding: Read Drone Preview Notes Without Guessing UTF-8
Compare Latin-1 tEXt and uncompressed UTF-8 iTXt payloads with a restricted offline example, preserving the distinction between image text and delivery evidence.

Separate the note from the picture
A PNG preview can accompany a drone mapping delivery as a convenient image for discussion. A text note stored with that image might contain an accented place name or another language. When a viewer displays unexpected characters, changing the note by hand is a poor first diagnostic. Start by identifying the metadata container and its encoding contract. This tutorial compares two invented chunk payloads in memory. It does not inspect an actual customer image, certify a preview, or imply that a NiVO aircraft writes either form of metadata. The exercise concerns preserving text during an offline review.
Keep the original image and any delivery notes together before attempting a conversion. A visible caption in an email, a filename and an embedded image description are separate pieces of evidence. They may have been written at different stages by different applications. Do not assume they agree merely because their wording looks similar. For this exercise, Description is only a keyword used to label sample text. It does not prove authorship, location, permission, image processing history or the relationship between a preview and a survey deliverable. Those relationships require explicit records outside this small decoding demonstration.
Use the format-defined encoding
The W3C PNG specification defines tEXt as a keyword, a zero separator and Latin-1 text. iTXt adds compression fields, a language tag and a translated keyword before its text; translated keyword and text use UTF-8. Its compression flag distinguishes uncompressed and compressed text. This tutorial deliberately accepts only an uncompressed iTXt profile with Description as the keyword and empty language and translated-keyword fields. The specification permits more than that profile. Rejecting another layout here means unsupported by this exercise, rather than invalid PNG.
That restriction keeps the example focused on the decoding decision. It also avoids introducing a general decompressor, a language tag validator or a whole image reader into a short handoff check. The payload is the chunk data only: no PNG signature, length, chunk type bytes, checksum or image data are supplied to the function. A production tool must establish the chunk boundaries and validate its enclosing file separately. Feeding arbitrary bytes from an image into this function would not establish that those bytes belong to a real text chunk. Treat the input boundary as an explicit precondition.

Product context only; this photograph does not depict the constructed examples in this article.
Decode two small, deliberately restricted payloads
Run this Python example without opening or changing any image. The tEXt fixture contains the Latin-1 encoding of cafe with an accented final letter. The iTXt fixture contains the UTF-8 encoding of a single river character. The helper accepts only the expected keyword, small byte strings and the declared local profile. For tEXt it narrows content to printable Latin-1 plus line feed; for iTXt it requires strict UTF-8 and rejects an embedded zero. Those choices make the tiny fixtures inspectable, while the function remains explicitly incomplete as a metadata validator.
def decode_note(kind, payload):
if not isinstance(payload, bytes) or len(payload) > 4096:
raise ValueError("expected a small chunk-data byte string")
prefix = b"Description\x00"
if not payload.startswith(prefix):
raise ValueError("unsupported keyword profile")
rest = payload[len(prefix):]
if kind == "tEXt":
if any(not (b == 10 or 32 <= b <= 126 or 160 <= b <= 255)
for b in rest):
raise ValueError("outside this printable Latin-1 profile")
return rest.decode("latin-1")
if kind == "iTXt":
# flag 0, method 0, empty language, empty translated keyword
if not rest.startswith(b"\x00\x00\x00\x00"):
raise ValueError("unsupported iTXt profile")
text = rest[4:]
if b"\x00" in text:
raise ValueError("embedded zero in text")
return text.decode("utf-8", errors="strict")
raise ValueError("unsupported chunk type")
latin = b"Description\x00caf\xe9"
international = b"Description\x00\x00\x00\x00\x00\xe6\xb2\xb3"
print(decode_note("tEXt", latin))
print(decode_note("iTXt", international))Compare bytes without rewriting the meaning
The first result is café and the second is 河. Their different byte sequences follow the selected chunk types, not a guess based on the appearance of a filename. Preserve a hexadecimal view of a small suspect payload in a private investigation note when appropriate. It lets another reviewer reproduce the decoding choice without relying on a screenshot of damaged text. Do not include sensitive embedded descriptions in a public issue merely to show the problem. An invented minimal fixture can demonstrate a decoder mismatch while the actual delivery remains within its existing access controls.
A useful negative experiment is to decode the international fixture using the tEXt branch after removing its extra iTXt fields and relabelling the remaining bytes. Latin-1 can map those individual bytes into characters, producing a different string rather than the intended character. This demonstrates why successful decoding alone is weak evidence. Conversely, the single accented Latin-1 byte is not a complete UTF-8 sequence. A strict UTF-8 decoder rejects it. Neither experiment authorizes relabelling an actual chunk or changing an image. They expose the consequences of choosing the wrong contract on controlled data.
Document unsupported forms precisely
A compressed iTXt payload, a translated keyword or a nonempty language tag will fail this local profile. That failure should be reported as unsupported here. Another conforming implementation may read those forms correctly. In particular, the PNG specification tells decoders to ignore the compression method when the text is uncompressed; this example still restricts it to zero to match its constructed encoder profile. The distinction belongs in the review note so nobody mistakes the exercise for a complete conformance test. A narrow reader is useful only when its rejected inputs are described honestly.
Do not turn repeated Description chunks into one dictionary value without considering what evidence would be lost. This helper reads one payload and has no policy for choosing among multiple notes. A complete file review should retain the chunk sequence and report each relevant occurrence before deciding which application display is being compared. Similarly, absence of a supported note says little about image quality or project completeness. The image may use another metadata mechanism, have had notes removed during export, or have relied on a separate delivery document. Investigate the actual workflow rather than inventing a missing narrative.
Keep text decoding inside the delivery review
For a real preview, record the tool used to identify the chunk, the file revision, the selected decoding and the exact scope of the check. If a corrected preview is supplied, retain both revisions and compare the relevant text deliberately. A change in metadata is a separate event from a change in pixels. A readable note does not establish correct coordinates, ground resolution, color management or survey accuracy. Follow the project’s normal image and geospatial checks before using the preview as supporting material. The small function above cannot answer those questions, even when both example strings print correctly.
The owner-supplied NiVO product photograph provides context for drone work and remains credited independently of the invented byte strings. It is not evidence of a particular PNG export or metadata feature. The useful habit is straightforward: identify the chunk, state the supported profile, decode under that profile and preserve enough evidence for another person to repeat the observation. When a note contains multilingual text, that discipline helps a reviewer describe a concrete encoding issue without rewriting the source or confusing a readable description with verified information about the delivery. Resolve content questions through the responsible handoff record.



