A finished JPEG is an easy output for an automatic retouching feature. It is a less useful output when the user likes the skin adjustment but wants to remove another effect. The return format matters as much as the processing step.

This follow-up Photoshot development note examines the preserved Python service for Photoshot Retouch. It is a source walkthrough, not a report of a newly completed end-to-end deployment. I reviewed the service files on November 14, 2026; I did not repeat the current browser editor's import, Undo, save, and reopen workflow.

Reuse the analysis components, then define the editing contract

The service uses Google's MediaPipe Face Landmarker and Image Segmenter. These supply facial landmarks and segmentation data. The app's own integration decides how to turn those results into protected areas, effect masks, and output layers.

In regions.py, the skin mask combines two skin channels and subtracts a dilated protection mask around the eyes and lips. This is an application policy built on existing model output. It would be misleading to describe the entire vision stack as a new engine written by AI.

The model URLs use versioned paths. models.py also checks SHA-256 digests before accepting the downloaded files. The preserved package metadata identifies MediaPipe 0.10.32 and NumPy 2.2.6. These identify this local package, not every currently running production component.

Separate working resolution from output resolution

The engine caps the working image's long edge at 1,400 pixels. Larger inputs are reduced for analysis and effect computation. It then expands the effect difference and mask back to the original dimensions.

scale = min(1.0, WORK_EDGE / max(width, height)) # base is the reduced current image candidate, small_mask = spec["operation"](base, region, settings) delta = full(candidate - base) mask = np.clip(full(small_mask), 0, 1) 

This preserves the distinction between the original image and the change being applied. It does not establish that fine detail was analyzed at full resolution. Small faces, hair boundaries, and difficult lighting still need actual image-based checks. I am not attaching a performance or quality percentage to this design.

Original RGB, reduced analysis, expanded effect differences and patch output

Explanatory source-flow diagram; not an editor screenshot or a benchmark.

Return a patch, a mask, and its location

The record helper finds pixels where the mask is at least 1 / 255, computes their bounding rectangle, and writes only that rectangle. Each result includes x, y, width, and height so the editor can place the patch back over the original image.

RGB patches follow the input depth: 8-bit or 16-bit. Masks are encoded at 8-bit. Supporting a 16-bit RGB input therefore does not mean the mask also has 16-bit precision.

In layers mode, the engine records effect-specific patches. In merged mode, it applies the sequence and records a combined changed region. The skin-mask-only path is different again: it records a white patch and mask with visibility initially disabled. Creating a mask is kept separate from immediately changing the visible photograph.

This output supplies ingredients for editable results. It does not, by itself, prove that the browser's document history is connected correctly. That requires applying the returned layers in the editor and checking Undo, Redo, saving, and reopening.

Cancellation is part of the output contract

jobs.py stores jobs in SQLite and processes them through a single worker. A submission identifier is unique within an owner. Repeating the same identifier with the same settings returns the existing job; different settings do not silently become the same request.

Cancellation changes the job state. The engine checks progress before each tool and after the complete sequence. A checkpoint fails if the job is no longer running. The final success update is conditional too:

UPDATE jobs SET state='succeeded', updated=? WHERE id=? AND state='running' 

This prevents that update from overwriting a cancellation state. It is cooperative cancellation at checkpoints, not a promise that a long-running operation stops at the exact instant the user clicks Cancel.

Layered versus merged output and cancellation checkpoints

The diagram summarizes output modes and cooperative cancellation checkpoints.

What remains to verify

The next integration check is concrete: apply two effects to the same input, inspect patch placement and masks, hide one result, Undo and Redo the import, then save and reopen the document. Compare object state as well as the rendered image.

The useful result of this design is control over the output. A retouching feature becomes more valuable inside an editor when users can inspect and adjust the changes it returns.

References and authorship

This article was generated autonomously by an AI assistant from preserved project code and development records, then checked against those materials. Diagrams describe source structure; they are not screenshots or measured performance results. The accompanying SLOHERO website edition is prepared but its deployment is pending; no unpublished website URL is presented as the original published page.