Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copy Photo Path — Tropy Plugin

A Tropy plugin that copies the file path or a formatted snippet of the selected photo(s) to the clipboard. Three output formats are supported, each configured as a separate plugin instance in Tropy’s preferences.

Why

Tropy’s native tropy:// scheme only opens the application — it cannot be used to display an image. This plugin copies a path that actually works as an image source in Markdown editors (Obsidian, etc.) or web components.

Installation

  1. Download or build the plugin as a .zip file. The archive must contain package.json, index.js, and icon.svg at its root (not inside a subdirectory).
  2. In Tropy: Preferences… > Plugins > Install Plugin, then select the .zip.
  3. The plugin appears in the list. Configure one or more instances (see below).

Setting up three Export menu entries

Tropy’s plugin API creates one Export sub-menu entry per configured plugin instance. To get three separate entries, add the plugin three times in Preferences > Plugins using the + button, and configure each instance:

Instance name action option
Copy Link link
Copy for Markdown md
Copy for Reframe reframe

After saving, the Export sub-menu will show:

File > Export Item
├── …
├── Copy Link
├── Copy for Markdown
└── Copy for Reframe

Options

Field Default Description
action link Output format: link, md, or reframe (see below).
format path For action: link only. path copies a plain file path; uri copies a file:// URI.
separator \n String used to join results when multiple photos are selected.

Output formats

link: plain path or URI

/Users/alice/Pictures/DP155021.jpg

With format: uri:

file:///Users/alice/Pictures/DP155021.jpg

md: Markdown image with caption

The caption is built from the item’s Dublin Core metadata: title, date, and source, separated by . . Missing fields are omitted.

![Inauguration du musée. 1924. Archives nationales.](/Users/alice/Pictures/DP155021.jpg)

reframe: rf-canvas web component

<rf-canvas src="file:///Users/alice/Pictures/DP155021.jpg"><rf-text>Inauguration du musée. 1924. Archives nationales.</rf-text></rf-canvas>

Keyboard shortcuts

Tropy’s plugin API does not expose keyboard accelerators for plugin menu entries. As a workaround on macOS, you can assign shortcuts via System Settings > Keyboard > Keyboard Shortcuts > App Shortcuts:

  1. Click +, select Tropy as the application.
  2. Set the menu title to the exact name of the instance (e.g. Copy Link).
  3. Assign the desired shortcut (e.g. ⇧⌘C).

Metadata mapping

The caption is read from the first non-empty value found under these JSON-LD property keys:

Field Keys tried (in order)
Title title, dc:title, dcterms:title
Date dc:date, dcterms:date, dcterms:created
Source dc:source, dcterms:source

Both plain strings and language-tagged { "@value": "..." } objects are handled.

Known limitations

  • Photos imported from the web (http/https) are passed through as-is; their path is already a usable URL.
  • The path field reflects the location Tropy currently tracks. In a Standard project this points to Tropy’s internal copy; in an Advanced (.tpy) project it points to the file you manage yourself. If the original file has been moved without consolidation, the path may be stale.
  • If no item is selected, Tropy passes the entire project to the plugin, which will copy the paths of all photos.

Development

To test without reinstalling the zip after each change, create a symlink from this directory to Tropy’s plugins folder (visible from Tropy’s Help menu), then reload the project window (Cmd+R with DevTools open).

Logs and notifications are also written to tropy.log (Tropy’s log folder, accessible from the Help menu).

To add a new output format, add one entry to the formatters getter in index.js and document the new action value in package.json’s option hint.

About

Tropy plugin to copy photo paths and formatted snippets (Markdown, Reframe) to the clipboard.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages