Skip to content

Auto-generated alt-text in images using OpenRouter#128

Merged
0xZhangKe merged 2 commits into
0xZhangKe:mainfrom
KonradIT:ai-autogenerate-alt-text
May 25, 2026
Merged

Auto-generated alt-text in images using OpenRouter#128
0xZhangKe merged 2 commits into
0xZhangKe:mainfrom
KonradIT:ai-autogenerate-alt-text

Conversation

@KonradIT

@KonradIT KonradIT commented May 9, 2026

Copy link
Copy Markdown
Contributor

This PR is inspired by this post: https://bsky.app/profile/ed3d.net/post/3mkvxlhyot22i

and by Ave's blog post: https://ave.zone/blog/playing-with-vlm-generated-alt-text

A new button shows up on the alt-text dialog to send the image to an LLM which returns the alt text.

The model prompt, model choice and max token size were taken from Ave's blog post as-is. I trust them in their analysis.

The iOS part is stubbed-out. WIP work is here, untested: https://github.com/KonradIT/Fread/tree/ai-autogenerate-alt-text-ios

UI changes:

A new config page was added to the settings to configure LLM autogenerated alt-text:

Screenshot_20260509-175928_1

After this is filled out properly with your LLM provider of choice (using OpenAI-compatible API requests, openrouter is just what I chose)

Button shows up when adding an image and tapping on ALT Generating the alt text Alt-text is now shown in the input box after generation
Screenshot_20260509-172514 Screenshot_20260509-172518 Screenshot_20260509-172532

@0xZhangKe

Copy link
Copy Markdown
Owner

I've done something similar before. Android actually provides this capability; we can use Android's built-in LLM to generate ALT Text for images. However, only some phones support this. My phone, although on the list of supported devices, doesn't actually support it, so this feature is unstable, which is why I haven't merged it into the main branch.

But your solution seems better; it works on any device. Thanks for the contribution.

https://github.com/0xZhangKe/Fread/commits/feat/genai/

@KonradIT

Copy link
Copy Markdown
Contributor Author

Hi! Yes, and also should work on iOS. I don't have a Mac/iphone to test the build so I left a stub in there and split the iOS image resizing work into a separate branch. Also this works with openAI or any service which uses open AI API spec.

@KonradIT KonradIT force-pushed the ai-autogenerate-alt-text branch from 08e6c0b to 77fc396 Compare May 13, 2026 19:02
@KonradIT

Copy link
Copy Markdown
Contributor Author

Hi @0xZhangKe ,

I've rebased off of your latest main the PRs I had with conflicts. Also, to fix the CI builds failing, see the fix: KonradIT@7f31769

@0xZhangKe 0xZhangKe merged commit 5f7f39b into 0xZhangKe:main May 25, 2026
1 check failed
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.

2 participants