Skip to main content

PhotoVariation Model

A PhotoVariation is a structured configuration that describes how a generated photo should look. It controls the simulated camera, framing, paper condition, capture artifacts, damage, and failure modes. When generating a photo, the variation is serialized to JSON and sent to Gemini alongside the clean document image and a fixed system instruction.

All Fields

FieldTypeDefaultDescription
namestr"default"Identifier for this variation
camerastr"Samsung Galaxy S8"Camera device (free text or preset name)
year_device_stylestr"2017 Android"Device era and style
aspect_ratiostr"4:3"Image aspect ratio
capture_intentstr"functional document photo"Why the photo is being taken
FieldTypeDefaultDescription
document_coveragestr"90% of frame"How much of the frame the document fills
backgroundstr"blurred warehouse hints only at edges"Background description
FieldTypeDefaultDescription
curvaturestr"slight"Paper curvature: none, slight, strong
foldsstr"none"Fold type: none, middle_vertical, dog_ear, multiple
wrinklesstr"minor"Wrinkle level: none, minor, medium, heavy
corner_bendsstr"none"Corner bend description
edge_curlstr"none"Edge curl description
FieldTypeDefaultDescription
anglestr"slight oblique"Camera angle: straight, slight_oblique, strong_oblique_45deg
skewstr"slight"Rotation skew: none, slight, moderate, strong
rotation_degreesfloat0Rotation in degrees (0-15)
focus_planestr"center sharp, edges softer"Focus distribution
FieldTypeDefaultDescription
motion_blurboolFalseEnable motion blur
blur_directionstr""Direction: horizontal, vertical, diagonal
glarestr"mild"Glare intensity: none, mild, strong
glare_locationstr""Where glare appears
shadow_from_handboolTrueHand shadow on document
uneven_lightingboolTrueNon-uniform ambient lighting
jpeg_compressionstr"light"Compression artifacts: none, light, moderate, heavy
FieldTypeDefaultDescription
hand_visibleboolTrueShow a hand holding the document
grip_typestr"thumb on lower corner"How the hand grips
glovestr"none"Glove type: none, warehouse glove, latex glove
FieldTypeDefaultDescription
stainStain?NoneStain configuration (see below)
dirt_marksboolFalseShow dirt marks
torn_edgeboolFalseTorn paper edge
FieldTypeDefaultDescription
cropped_headerboolFalseHeader cut off by framing
missing_areastr""Missing area description (e.g. "top 10-15%")
overexposed_patchboolFalseOverexposed area
shadow_bandboolFalseDark shadow band across document
FieldTypeDefaultDescription
stapledboolFalseStapled pages
stacked_sheets_behindint0Number of sheets behind the main document

Stain Model

The Stain dataclass configures document contamination:
FieldTypeDefaultOptions
typestr"coffee"coffee, water, grease, ink
locationstr"upper_right"upper_right, center, lower_left, random
opacitystr"semi-transparent"light, semi-transparent, heavy
text_obstructionstr"partial"none, partial, severe

Built-in Presets

Penquify ships with 8 presets covering common operational capture scenarios:
PresetKey Features
full_picture90% coverage, slight curvature, slight oblique angle
folded_skewedDog ear folds, strong curvature, moderate skew, 6 degree rotation
zoomed_detail95% coverage, tight crop, center-focused sharpness
blurryMotion blur (horizontal + downward), overall soft focus
cropped_headerTop 10-15% of document cut off
strong_oblique45 degree angle, strong skew, vertical fold, strong curvature
coffee_stainCoffee stain (upper right, semi-transparent, partial text obstruction), medium wrinkles
stapled_stackStapled with 2 sheets behind, dog ear folds

Full JSON Example

{
  "name": "warehouse_capture",
  "camera": "Samsung Galaxy A10",
  "year_device_style": "2019 budget Android",
  "aspect_ratio": "4:3",
  "capture_intent": "quick operational capture",
  "document_coverage": "88% of frame",
  "background": "loading dock concrete floor edges",
  "curvature": "strong",
  "folds": "dog_ear",
  "wrinkles": "medium",
  "angle": "above-right perspective",
  "skew": "moderate",
  "rotation_degrees": 4.5,
  "focus_plane": "center sharp, edges softer",
  "motion_blur": false,
  "glare": "mild",
  "shadow_from_hand": true,
  "uneven_lighting": true,
  "jpeg_compression": "moderate",
  "hand_visible": true,
  "grip_type": "pinched top edge",
  "glove": "warehouse glove",
  "stain": {
    "type": "grease",
    "location": "lower_left",
    "opacity": "light",
    "text_obstruction": "none"
  },
  "dirt_marks": true,
  "cropped_header": false,
  "stapled": false,
  "stacked_sheets_behind": 0
}
You don’t need to specify every field. Defaults are designed for a reasonable operational photo. Override only what you need.