Metadata-Version: 2.4
Name: wagtail-alt-text-generator-ai
Version: 1.0.0
Summary: Write SEO-friendly alt text for the images in your Wagtail library. Generate it for one image, a selection or every image that is missing it, review it, and save. 131 languages.
Author: Bryam Loaiza
License: MIT
Project-URL: Homepage, https://alttextgeneratorai.com/integrations/wagtail-package
Project-URL: Repository, https://github.com/balt1794/wagtail-alt-text-generator-ai
Project-URL: Issues, https://github.com/balt1794/wagtail-alt-text-generator-ai/issues
Keywords: wagtail,alt text,accessibility,seo,images,ai
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Wagtail
Classifier: Framework :: Wagtail :: 6
Classifier: Framework :: Wagtail :: 7
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: wagtail>=6.3
Dynamic: license-file

# Alt Text Generator AI for Wagtail

<img src="https://raw.githubusercontent.com/balt1794/wagtail-alt-text-generator-ai/main/assets/logo.png" alt="Alt Text Generator logo" width="64" />

Write SEO-friendly alt text for the images in your Wagtail library. Generate it for one image, for a selection or for every image that is missing it, review it, and save. 131 languages.

[Get a free API key](https://alttextgeneratorai.com/dashboard)

## What you get

- **A bulk page in the admin.** **Alt Text Generator AI** sits in the main menu. It lists your images with a preview, shows the ones with no description, and writes it for all of them or only the ones you tick.
- **Review before saving.** Edit any text, then save everything at once. The text goes into the image's **Description**, which Wagtail uses as the default alt text when you insert the image in rich text or an image block.
- **Nothing is overwritten by accident.** *Generate all missing* skips images that already have a description. Tick an image to write a new one for it, and it is only saved when you click **Save changes**.
- **131 languages** for the text, including English, Spanish, French, German, Italian, Portuguese, Dutch, Russian, Chinese, Japanese, Korean, Arabic and Hindi.
- **Credits shown on the page.** One credit writes alt text for one image. New accounts get free credits.
- **Your key stays on your server.** The API key is only used by Django and never reaches the browser.
- **Respects Wagtail permissions.** Editors who may change images can generate and save. Only superusers can change the API key.

## Requirements

- Wagtail 6.3 LTS or newer (the image **Description** field was added in 6.3)
- Python 3.9 or newer
- An Alt Text Generator API key ([get one free](https://alttextgeneratorai.com/dashboard))

## Install

```sh
pip install wagtail-alt-text-generator-ai
```

Add the app to `INSTALLED_APPS` and run the migration:

```python
INSTALLED_APPS = [
    # ...
    "wagtail_alt_text_generator_ai",
    # ...
]
```

```sh
python manage.py migrate
```

Open **Alt Text Generator AI** in the admin menu, paste your API key and click **Save key**.

## Use it

1. Open **Alt Text Generator AI**. It lists your images and shows your credits.
2. **Missing** shows the images with no description. **All** shows everything.
3. Tick the images you want, or leave them all unticked.
4. Click **Generate selected** or **Generate all missing**. Each image uses 1 credit.
5. Read the results, change anything you like, then click **Save changes**.

## Settings

All settings are optional.

| Setting | What it does |
| --- | --- |
| `ALT_TEXT_GENERATOR_API_KEY` | API key to use when none was saved in the admin. A key saved in the admin takes priority. |
| `ALT_TEXT_GENERATOR_AUTO_GENERATE` | Write alt text automatically for new uploads. On by default once an API key is set. Set to `False` to turn it off. |
| `ALT_TEXT_GENERATOR_LANGUAGE` | Default language, for example `"german"`. By default it follows `LANGUAGE_CODE`. |

## Good to know

- Images are shrunk to 1024 px on the long side before they are sent.
- Descriptions are limited to 255 characters by Wagtail. Longer text is shortened with an ellipsis, and you are told when that happens.
- SVG images are skipped, because they cannot be described from their pixels.
- Generating is done a few images at a time, so a large library can take a few minutes. You can stop at any point and keep what was written.

## Development

```sh
pip install -e .
python manage.py test wagtail_alt_text_generator_ai
```

## License

MIT. See [LICENSE](LICENSE).
