Skip to content

Add image_find: stock photos first, licence record per picture - #27

Merged
IsraelWebDev merged 1 commit into
mainfrom
card/image-find
Nov 11, 2026
Merged

IsraelWebDev merged 1 commit into
mainfrom
card/image-find

Conversation

@IsraelWebDev

Copy link
Copy Markdown
Owner

What

Adds image_find, a stock-photo tool, as an MCP tool and as funkbox image find.

  • Searches Pexels first, then Unsplash. Returns the first provider's results.
  • Downloads the pick to inputs/<name>.jpg and writes inputs/<name>.credit.json next to it: source, author, licence, credit line, contains_people, release_status, query, retrieved date.
  • Refuses any record missing those fields, or with an empty credit line for Unsplash.
  • Calls Unsplash's download-tracking endpoint when a photo is taken.

The rule

  • Stock first. fallback="none" is the default.
  • People are never generated. A query with people words (or people=true) searches stock only. A miss returns NO MATCH.
  • FastSD only for pictures without people, and only with fallback="fastsd_scene". The result is tagged generated with its own record.
  • Keys come from PEXELS_API_KEY / UNSPLASH_ACCESS_KEY in the environment only. Nothing is written to a file or logged. With neither set, the tool answers NOT CONFIGURED and sends nothing.

Changed

  • funkbox/studio/stock.py (new), funkbox/studio/tools.py (tool), funkbox/studio/images.py (CLI verb), funkbox/tool_options.py (StockOrientation, StockFallback enums).
  • image_generate description now says it is not for pictures of people.
  • docs/catalog.json regenerated (python -m funkbox catalog --check passes). Tool count 50 → 51 in README, llms.txt and the server tests.
  • docs/studio.md, both funk-studio SKILL.md copies (kept identical), THIRD_PARTY_NOTICES.md (photos section). README's "no API keys" line now says stock search is the optional part.

Tests

  • tests/studio/test_stock_find.py: 11 tests, all offline (fake HTTP, injected generator). Covers the people rule, record validation, the parsers, Pexels before Unsplash, no-key behaviour, no FastSD for people, FastSD tagging, the download and credit record, and the MCP surface.
  • Updated counts in tests/test_server.py and tests/test_p6_install.py.
  • Full suite before PR: python -m pytest -q -p no:cacheprovider tests → 1277 passed, 13 skipped (about 25 min).
  • ruff check and ruff format --check clean on changed files.

Not in this PR

  • No live API calls. Live search needs the owner's free keys.
  • Unsplash's API guidelines may ask for hotlinking rather than local copies. Confirm before shipping.
  • Identifiable people in product ads need a release. release_status records the licence but cannot verify a release.

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34


Generated by Claude Code

image_find (MCP tool and `funkbox image find`) returns a licensed stock photo from
Pexels, then Unsplash, saved to inputs/ with inputs/<name>.credit.json (author,
licence, credit line, contains_people, release_status).

Rule: stock first. A picture with people is never generated (FastSD renders faces
badly): no match means try other words. FastSD is a fallback only for a picture
without people, and only with fallback="fastsd_scene"; its result is tagged generated.

Keys come from PEXELS_API_KEY / UNSPLASH_ACCESS_KEY, read from the environment only.
With neither set the tool answers NOT CONFIGURED and sends nothing. HTTP and the
generator are injectable; the tests run offline.

image_generate's description now says it is not for pictures of people.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
@IsraelWebDev
IsraelWebDev merged commit 0d31c5c into main Nov 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant