Files
chrome-extensions-samples/functional-samples/ai.gemini-on-device-alt-texter/README.md
Sebastian Benz 85f721f5a9 Improve Gemini samples (#1611)
* Migrate to latest version of the language model

* Update readme to better describe the sample.

* More readme updates

* Consistent API naming and format lists
2026-01-15 13:38:00 +01:00

1.3 KiB

Alt Texter: Generate accessible image descriptions with Chrome's built-in Prompt API

This sample demonstrates how to use Chrome's built-in AI APIs to generate alt text for images, making web content more accessible. It combines two on-device AI capabilities:

  • Prompt API with multimodal input (Gemini Nano) for image understanding
  • Translator API for translating descriptions into multiple languages

Overview

Alt Texter adds a context menu entry for images on the web. When activated, it:

  1. Analyzes the image using Gemini Nano's multimodal capabilities.
  2. Generates a concise, functional description following accessibility best practices (object-action-context framework).
  3. Displays the description in a popup where you can optionally translate it.
  4. Lets you copy the alt text to your clipboard for use elsewhere.

Running this extension

  1. Clone this repository.
  2. Load this directory in Chrome as an unpacked extension.
  3. Right-click an image on a webpage and select "Generate alt text".
  4. Wait for the description to be generated, then optionally translate it or copy it to your clipboard.