Search images by relationship

Search a photo library or video frames for how things relate, not just which tags they carry, and get the matching files back.

opengraph-image build ./frames

Reads

  • t00041.jpg
  • t00042.jpg
  • street-14.jpg

Writes edges like

  • person holding umbrella 0.93
  • bicycle in_front_of building 0.88
  • street-14.jpg has_text "EXIT" 0.86
  • street-14.jpg in_scene outdoor 0.98
frames/opengraph-out/graph.json

Keyword search can find every photo tagged person and every photo tagged umbrella. It cannot tell you which ones show a person holding the umbrella, rather than standing near a closed one in a stand. OpenGraph Image records the relationship itself, so a query matches on structure instead of wording.

From tags to relationships

Match the arrangement, not the words.

Tags and captions return any image that mentions both things, in any arrangement. A graph query matches the edge itself, along with scene labels, text read from inside the image, and attributes like color and material. Because relations and attribute keys come from fixed vocabularies, the same question matches the same way across the whole collection.

office-02.jpg

  • laptopon_top_ofdesk0.94
  • office-02.jpgin_sceneindoor_commercial0.96
  • mughas_attributecolor: red0.89
  • mughas_attributematerial: ceramic0.84

Search from your agent

Build once, then ask in plain language.

Build a graph of the folder and register the MCP server, and any MCP-compatible agent can search it. Asking for everything extracted from one file calls get_image_entities, the quickest way to check why an image matched before you rely on it.

  1. You

    Show everything extracted from street-14.jpg.

  2. get_image_entities("street-14.jpg", "./photos")
  3. Agent

    A person, an umbrella, a bicycle, and a building in an outdoor scene, the text "EXIT", and how each object relates to the others.

Video

Sample frames today, then search them.

OpenGraph Image reads still images, not video files. Sample one frame per second into a folder and the frame number tells you where to look: numbering starts at 1, so t00042.jpg is roughly the 41-second mark. Raise the rate for fast-moving scenes, or lower it to keep builds cheap on long recordings. Native video support, including events that unfold across frames, is not part of the current release.

 mkdir frames
 ffmpeg -i site-walkthrough.mp4 -vf fps=1 frames/t%05d.jpg
 opengraph-image build ./frames

Good fits

Where the arrangement is the question.

  • Product and catalog photography, where buyers ask for arrangements ("a sofa next to a floor lamp")
  • Field inspection and site photos, where the question is what sits on, inside, or behind what
  • Recorded demos and walkthroughs, sampled into frames and searched by what appears on screen
  • Each image is a model callBuild cost and time scale with the size of the collection, so sample video frames sparingly.
  • Fixed vocabularies cut both waysMatching is consistent, but a relation outside the set, such as "leaning against", is not recorded.
  • No identity across framesThe graph knows a car appears in 40 frames, not whether it is the same car.

Build your first graph

Open source under Apache-2.0. Runs locally with your own Anthropic API key.