Templating - rootiest/obsidian-ai-image-ocr GitHub Wiki

Templating Reference

Placeholders

You can use these dynamic placeholders in your output template to customize the format of extracted text.

Placeholders are enclosed in double curly braces {{ }} and can be used in any settings field where the description states:
{{placeholders}} are supported.

The following list shows the placeholders that are currently available:

Model & Provider

  • {{model.id}} — The model ID (e.g. gemini-flash-2.5, gpt-4o)
  • {{model.name}} — The model model friendly name (e.g. Gemini Flash 2.5, GPT-4o)
  • {{provider.name}} — The provider friendly name (e.g. OpenAI, Google)
  • {{provider.id}} — The provider ID (e.g. ollama, gemini, custom)
  • {{provider.type}} - The provider API type (e.g. gemini, openai)

Image Metadata

  • {{image.name}} — Image filename without extension
  • {{image.extension}} — Image file extension (e.g. png, jpg)
  • {{image.mime}} — Image mimetype (e.g. image/png, image/jpeg)
  • {{image.path}} — Full image path (e.g. /path/to/image.png)
  • {{image.size}} — Size in bytes (e.g. 123456)
  • {{image.dimensions}} — Dimensions in pixels (e.g. 1280x720)
  • {{image.width}} — Image width in pixels (e.g. 1280)
  • {{image.height}} — Image height in pixels (e.g. 720)

Embed Metadata

  • {{embed.alttext}} — Image embed alt text or caption (if available)
  • {{embed.url}} — Image embed URL (if available)
  • {{embed.path}} — Image embed path (if available)

Embed Original Image

As of version 0.9.0

  • {{image.image}} — Embed image file in output

[!NOTE] This is only compatible with the header/footer templates (not filename or file path)
The image will be placed in the default attachments folder and an embed will be generated in the template.
Images are only attached when they are used in this placeholder.

Date-Times

Templated fields in the plugin settings support moment.js date-time formatting. These will produce formatted date and time text for the current date and/or time when the template is applied.

Some examples of date-time formats you can use:

  • Short Date - {{YYYY-MM-DD}} - 2025-07-02
  • Short Date-Time - {{YYYY-MM-DD HH:mm:ss}} - 2025-07-02 22:45:12
  • Long Date - {{MMMM Do YYYY - October 1st 2025
  • ISO 8601 - {{YYYY-MM-DDTHH:mm:ssZ}} - 2025-07-02T22:45:12Z
  • Unix Timestamp - {{X}} - 1751505900
  • Unix Timestamp (milliseconds) - {{x}} - 1751505900000
  • RFC 2822 - {{ddd, DD MMM YYYY HH:mm:ss ZZ}} - Wed, 02 Jul 2025 22:45:00 GMT
  • Human-Readable - {{dddd, MMMM Do YYYY, h:mm A}} - Tuesday, July 2nd 2025, 10:45 PM
  • File-Safe - {{YYYY-MM-DD_HH-mm-ss}} - 2025-07-02_22-45-00
  • US Date - {{MM/DD/YYYY}} - 07/02/2025
  • European Date - {{DD.MM.YYYY}} - 02.07.2025

[!NOTE] Be mindful of possible character restrictions in filenames or paths.

Example

  • Base Header:
## Extracted {{MMMM Do YYYY}} with {{provider.name}} {{model.name}}
  • Per-Image Header:
### {{image.filename}} - {{MMMM Do YYYY, h:mm:ss a}}

  • Per-Image Footer:

---

  • Base Footer:
End of extracted text.

Will produce an output like this:

## Extracted 2025-07-04 with Google Gemini Flash 2.5

### first-image.png - October 1st 2024, 3:45:12 pm

Some handwritten text

- Listed text in a note
- A second item

---

### 2025-03-09 second-image.png - March 9th 2025, 12:29:42 pm

Text from the second image

- [x] A checked checkbox in the second image

---

End of extracted text.


More placeholders and formatting options may be introduced in future releases!