Code from a picture
Turn code in a photo into plain text and insert it at the caret — a computer screen, a book page, or another phone all work.
Where: the editor toolbar's 📷 Code in photo (or the item of the same name in the ☰ menu).
The whole flow
- Put the caret where the code should go (an existing selection is replaced)
- Tap 📷 Code in photo, then pick the source: Camera or Gallery
- The picture opens in a crop step: drag a box around just the code, then confirm
- The boxed area is sent to the model (the screen shows "Reading code from the picture…")
- The result is handled automatically — see the three cases below
Crop first, recognise second is deliberate: when the shot includes a desk, your hand or the background, only what is inside the box is read. Loose boxes tend to pull book titles, page numbers and watermarks into the result.
Three possible outcomes
| Case | What happens |
|---|---|
| Everything recognised | Inserted directly, with a "Inserted N line(s)" toast |
| Some characters unclear | A dialog shows the result and you decide; check the □ marks afterwards |
| No code in the picture | Only a "No code found" message — nothing is inserted |
The third case is guarded on purpose: when the model finds no code it tends to answer with a sentence ("Sorry, there is no code in this picture"), and inserting that would write junk into your source file.
What the □ means
**Unclear characters are marked □ instead of being guessed.**
The usual confusions in code are 0/O, 1/l/I, {/}, (/() and ;/:. One wrong character can shift the compile error by several lines — □ shows you exactly which spot to check.
A vision-capable model is required
Photo reading uses the current model's vision ability. Models marked Vision in the model catalog work reliably; unsupported ones surface the server's own message (for example model does not support image input) instead of a vague "failed".
Recognition gives up after 120 seconds and reports a timeout.
Common questions
- Read-only files cannot be inserted into: large files and read-only mode show "Read-only file: can't insert". Tap the target line first so the editor is in edit mode.
- Blurry shots: get closer, face the screen straight on, avoid glare and fingerprints, raise the brightness and zoom the text in before shooting.
- Cropping too loosely: line numbers, minimap and scrollbars inside the box are mostly ignored, but a tight box gives a better result.
- Indentation looks off: the model preserves the picture's own layout. If the source image was inconsistent, adjust the block once after inserting — the whole insert is a single undo step.