NiVO / BY TECHNOGISGermany · Indonesia
Image review tutorial

JPEG Chroma Subsampling: Inspect a Drone Image Handoff Without Re-saving It

Read JPEG sampling with Pillow, distinguish 4:4:4, 4:2:2 and 4:2:0, and keep color sampling separate from image dimensions and survey acceptance.

JPEG Chroma Subsampling: Inspect a Drone Image Handoff Without Re-saving It

Ask a narrower question than whether the image looks sharp

Two JPEG deliverables can have identical width and height while differing in how color information is sampled. That distinction can matter when a drone project hands over review photographs containing colored labels, fine painted boundaries, or other small color transitions. An initial inspection should establish what the file reports before anyone re-saves it in a preferred editor. Re-exporting merely to check a setting changes the object under review and makes the received version harder to discuss. Keep the original intact and make the inspection question explicit: which sampling pattern does this decoder recognize?

This guide demonstrates a local Pillow check with a synthetic color image held entirely in memory. It does not examine a NiVO camera file or establish which JPEG settings any aircraft uses. The accompanying product photograph supplies catalogue context only. In a real handoff, place sampling information alongside file identity, dimensions, capture context, and the intended review task. Treat the label as one descriptive property. A recognized pattern is neither a quality grade nor evidence that a photograph meets the positional, radiometric, or completeness requirements of a mapping deliverable.

Read the sampling label without confusing it with resolution

Pillow describes chroma subsampling as encoding chroma information at lower resolution than luma information. Its documented sampling codes are 0 for 4:4:4, 1 for 4:2:2, and 2 for 4:2:0. These labels describe a relationship between component sampling, not a replacement for the image width and height. The cover diagram presents conceptual component grids to make that distinction visible. It is not a crop from a real photograph and does not depict the size of a ground feature, a sensor pixel, or an observed compression artifact.

Keep the numeric code and the readable label together in an inspection record. A bare value such as 2 becomes ambiguous when copied into another tool or a project spreadsheet without the API name. Also retain an explicit unrecognized result rather than converting every unexpected code to 4:4:4. The Pillow implementation returns -1 for cases outside its recognized three-component patterns, including grayscale and CMYK cases. That outcome needs an accurate description of this inspection limit. It does not by itself mean that the image is corrupt or unsuitable for every possible use.

NiVO VTOL V5 product image showing the fixed wing and vertical-lift rotors
NiVO VTOL V5 product image showing the fixed wing and vertical-lift rotors.Source: NiVO / TechnoGIS catalogue materials supplied by the site owner · Catalogue photo
Product context only; this photograph does not depict the constructed examples in this article.

Run a controlled sampling inspection in memory

The example requires Pillow and prints the installed version so that the result can be tied to a particular runtime. It constructs the same small RGB image three times and explicitly requests each documented sampling option when saving into a BytesIO stream. The sampling_label function opens that stream as an image, confirms JPEG format, and calls JpegImagePlugin.get_sampling. No image file is written, and no project source is modified. This controlled demonstration establishes how the inspection reports known requested settings in the local environment; it is not a comparison of aerial image quality.

The expected labels in order are 4:4:4, 4:2:2, and 4:2:0. All three outputs retain the same declared dimensions, illustrating why dimensions alone do not identify the sampling pattern. The quality argument is held at one teaching value so that it is not mistaken for the variable being inspected. That value is an example setting, not a recommended delivery threshold. To inspect a real received JPEG, pass its preserved bytes to the same function in a controlled working process and record the filename or project identifier separately from the returned label.

import io
import PIL
from PIL import Image, JpegImagePlugin

LABELS = {0: "4:4:4", 1: "4:2:2", 2: "4:2:0"}

def sampling_label(raw):
    with Image.open(io.BytesIO(raw)) as image:
        if image.format != "JPEG":
            raise ValueError("Expected JPEG input")
        code = JpegImagePlugin.get_sampling(image)
        return image.size, code, LABELS.get(code, "unrecognized")

print("Pillow", PIL.__version__)
# Synthetic color field, not a captured aerial image.
toy = Image.new("RGB", (16, 16), (30, 150, 90))
for requested in (0, 1, 2):
    stream = io.BytesIO()
    toy.save(stream, format="JPEG", quality=90, subsampling=requested)
    print(sampling_label(stream.getvalue()))

Understand what the check leaves unexamined

This function reads information through the JPEG plugin; it does not perform a full image-quality inspection. It does not measure a colored edge, compare decoded pixels with a lossless original, inspect every scan for damage, or evaluate the effect of a particular display scale. Its call to open should not be described as successful complete decoding of all image content. If full readability is part of the handoff, perform that separate check with the agreed tools and retain its result separately. A useful report says which question was tested instead of allowing one successful metadata lookup to stand for every image check.

Sampling also does not reveal the entire editing history. A current 4:4:4 file may have been derived from an earlier subsampled file, and its current label cannot restore information that was absent from the earlier representation. Conversely, a 4:2:0 label alone does not identify a specific visible defect in a particular photograph. Assess the actual feature and intended task with an appropriate reference. Record the provenance of each derivative so that a reviewer can distinguish a camera original, a project export, and a presentation copy without inferring that history from one header property.

Review the received version before deciding on a derivative

For an actual inspection package, begin with the unchanged received JPEGs and their recorded identities. Summarize sampling patterns together with dimensions and the reader version, then investigate exceptions instead of silently forcing them into a default category. Where colored annotations or boundaries are part of the review, choose representative regions in the original and inspect them in the receiving application at a documented scale. Label those observations as project review findings only after they have actually been made. The synthetic demonstration here supplies no evidence about the visibility of any real annotation or surface feature.

If a downstream workflow requires a different representation, agree the export path and retain the received version. Simply converting an existing JPEG to a new sampling setting does not establish that its original color detail has been recovered. Prefer returning to the appropriate source when available and documenting the new derivative. Keep color management, sharpening, resampling, and annotation handling in the export record as separate choices. This prevents a request for a sampling label from expanding into an unexplained series of edits that makes later comparison or issue reproduction difficult.

Write a handoff conclusion with an honest boundary

A clear conclusion might state that a particular received file was recognized by a named Pillow version as JPEG, had specified dimensions, and returned sampling code 2 mapped to 4:2:0. Attach the recorded file identity and any independently performed readability or visual review evidence. If the result was unrecognized, state that result directly and investigate with a suitable reader. Avoid replacing it with a guess based on the filename, the number of channels shown in another program, or an assumed default from the application that exported the file.

The decision to accept a drone-image handoff should follow the intended use and the actual review evidence. Sampling information can explain a difference between versions and help focus a discussion with the producer, but it cannot supply a survey accuracy statement or guarantee interpretation of small features. Preserve the original, keep the inspection reproducible, and make any requested replacement explicit. The practical gain is a better-described deliverable: reviewers know which representation they received and which questions remain for visual assessment, rather than treating a familiar JPEG extension as a complete technical specification.

Technical references

  1. Pillow JpegPresets: subsampling codes and inspection API ↗
  2. Pillow JPEG implementation: get_sampling recognized patterns and -1 cases ↗
  3. Pillow Image.open: identification and lazy decoding ↗
← All articles

Related articles

All articles ↗
LET’S TAKE FLIGHT

Your next mission
starts with a conversation.

Talk to our team