# Optimal Framing for Group Photographs

> Where to place a green-screen group cutout on a print so nobody is cropped and no design covers a detected face: proofs, an exact algorithm and a replay of 12,448 photos.

An exact algorithm that keeps everyone in the frame and every face visible.

Research paper by Matvei Lapushinskii, TheArtisan.ai, Amsterdam, 27 November 2026. [Download the PDF (15 pages, 1.5 MB)](https://theartisan.ai/technology/optimal-framing.pdf)

A green-screen photo kiosk cuts the group out of the camera photo and places it on a printed design. The paper defines a correct placement, proves which placement is optimal and gives the algorithm that finds it.

## Abstract

A camera that is installed at a venue cannot frame each group. The camera is fixed, the next group may be one person or eight, and the output rarely has the aspect ratio of the photograph. A practical answer is to capture the widest view possible and to let software choose the framing: a position and a size for the group in the output frame. A common default for that choice scales the photograph to the height of the frame and centres it. In a replay of 12,448 photographs from the 10,000 most recent customer sessions at our photo kiosks, this default gives a picture with a cropped person or a lost face 258.6 times in 1,000. We state framing as an optimisation problem with four requirements: everyone is inside the frame, everyone has the same scale, no face is under a foreground element, and no camera cut is visible. We prove that an exact optimum exists whenever a centred framing within the size bounds meets the requirements, for a frame of any shape and size, and that its scale is one of a polynomial number of candidates, so the problem needs no exponential search. We give a search that computes the optimum in rational arithmetic. We also prove that some photographs admit no framing that meets all four requirements. For those, the algorithm changes the layer order locally, so that a face is drawn in front of the element that would cover it. The procedure returns a picture for every photograph with a non-empty cutout, also when the search runs out of time. In the same replay it leaves 22.9 defective prints in 1,000, and all but 4 of these 285 prints are pictures that it sets inside a drawn border. In a sweep of 31 placement policies on four measures (defects, group size, changed foreground and centring), no policy has fewer defects. One policy dominates the method, by 0.001 percentage points of changed foreground. On a tall frame the size bound of the print formats leaves most groups without a framing that meets the requirements. A size bound that follows the frame shape removes this limit and keeps every exact optimum on the print formats. We test it on outputs from 1:3 to 3:1. The core lemmas are checked in Lean 4. The example figures show real groups as flat silhouettes: the alpha masks of production photographs.

## What a correct placement means

- **Everyone in the frame.** No person is cropped at an edge of the print.
- **One scale for the group.** The whole group is scaled by the same factor, so nobody is stretched or shrunk against the others.
- **No hidden face.** No element of the printed design is drawn over a face box that the software receives.
- **No visible camera cut.** Where the edge of the camera photo cut through a person, that straight line sits on the edge of the print or under the design, not in the middle of the picture.

Among the placements that meet all four requirements, the best one centres the group and makes it as large as possible. The paper proves that this optimum exists whenever a centred placement within the size bounds meets the requirements, and that its coordinates are exact fractions. The optimal scale is one of polynomially many candidates, so the problem needs no exponential search. A variant whose size bound follows the frame shape has an optimum for a frame of any size whenever a feasible placement exists, and keeps every exact optimum on the print formats.

## Some group photos have no correct placement

The paper proves that some photographs admit no placement that meets all four requirements: for example, people in the front row cut at the face by the camera, with scenery along the bottom of the print. For such photographs the algorithm draws the covered faces in front of the scenery, so it still returns a picture for every photograph with a non-empty cutout.

## Results on production photographs

A replay of 12,448 photographs from the most recent customer sessions at 13 of our venues (8 August 2026 to 23 November 2026) framed each photograph with both methods, for the format that was printed. Replayed pictures with a defect (a person cropped, a face lost or a camera cut visible), per 1,000 pictures:

- Previous rule (scale to the print height and centre): 258.6
- Proposed method: 22.9
- On the 1,587 photographs from 4:3 cameras: 32.8 against 16.4

The rates are for replayed pictures, not for prints that customers received. Most remaining defects of the proposed method are pictures that it deliberately sets inside a drawn border. The gain depends on the camera: on 4:3 cameras the previous rule crops nobody, and most venues changed to 4:3 cameras in November 2026.

## What the results cover

- The optimum exists for a frame of any shape and size whenever a centred framing within the size bounds meets the requirements.
- The method works on the group as a separate layer, from a green screen or a segmentation model. A photograph without such a layer, where the background moves with the group, is a different problem that the paper does not treat.
- Faces are protected through face boxes. Without them the method protects the whole group, and a face that the detector misses is not protected.
- “Best” is geometric: centred and as large as allowed. Nobody was asked which prints they prefer, and no physical print was judged.
- All data come from one application. The method is not yet in production: the results replay recorded production photographs with both methods, not prints that customers received.

## Read the paper

[Optimal Framing for Group Photographs (PDF, 15 pages, 1.5 MB)](https://theartisan.ai/technology/optimal-framing.pdf)

The example figures show real groups only as flat silhouettes, the alpha masks of production photographs, with drawn scenery. [More about our technology](https://theartisan.ai/technology)

---

Canonical URL: https://theartisan.ai/technology/optimal-framing
Site: TheArtisan.ai — https://theartisan.ai/
Contact: info@theartisan.ai · contact form: https://theartisan.ai/technology/optimal-framing#contact
Privacy and terms: https://theartisan.ai/legal/privacy-terms.pdf
Company: TheArtisan.ai S.à r.l. · 2 Route de Cruchten, L-7738 Colmar-Pont, Luxembourg · RCS B299196 · VAT LU36822229
