From 44720168f03dd77c8d9e24f0aa89ce6bd74af34b Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Mon, 7 Sep 2026 12:40:55 -0500 Subject: [PATCH] Add Generate Image Alt Text Across Claude Models as an LLM TIL --- README.md | 3 +- ...ate-image-alt-text-across-claude-models.md | 59 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 llm/generate-image-alt-text-across-claude-models.md diff --git a/README.md b/README.md index 473666e..e509839 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). -_1877 TILs and counting..._ +_1878 TILs and counting..._ See some of the other learning resources I work on: @@ -739,6 +739,7 @@ If you've learned something here, support my efforts writing daily TILs by ### LLM - [Count Number Of Tokens In A File](llm/count-number-of-tokens-in-a-file.md) +- [Generate Image Alt Text Across Claude Models](llm/generate-image-alt-text-across-claude-models.md) - [Include A File With Message To `ant`](llm/include-a-file-with-message-to-ant.md) - [Send cURL To Claude Text Completion API](llm/send-curl-to-claude-text-completion-api.md) - [Use The llm CLI With Claude Models](llm/use-the-llm-cli-with-claude-models.md) diff --git a/llm/generate-image-alt-text-across-claude-models.md b/llm/generate-image-alt-text-across-claude-models.md new file mode 100644 index 0000000..f33f17a --- /dev/null +++ b/llm/generate-image-alt-text-across-claude-models.md @@ -0,0 +1,59 @@ +# Generate Image Alt Text Across Various Claude Models + +I sometimes experiment with what LLMs will come up with for _alt text_ for an +image to see how it compares to what I would have written. Especially with some +of the latest models I find that it is more comprehensive and detailed that I +would have been. + +Here is an image that I used [in a recent blog post](https://www.visualmode.dev/parameterize-a-fixture-instead-of-a-test-case-with-pytest): + +![Diagram comparing two test suites. Left, "Behavioral Tests": a single column of six test rows, four passing (green check) and two failing (red X). Right, "Parameterized Behavioral Tests": a list of three parameters (circle, triangle, diamond) with arrows fanning out to three columns, each rerunning the same six tests tagged with that parameter's shape — the circle column all passing, the triangle column with three failures, the diamond column with one failure.](https://cdn.visualmode.dev/blog/parameterized-behavioral-tests.png) + +And here are four samples of alt text for that image that I requested from +various Claude models via inline prompts to the `claude` CLI: + +```bash +❯ claude -p "Produce a concise alt text for the following image: @image.png" \ + --model opus --effort medium --output-format json \ + | jq '.result' +"Alt text:\n\n> Diagram comparing two test suites. Left, \"Behavioral Tests\": a single column of six test rows, four passing (green check) and two failing (red X). Right, \"Parameterized Behavioral Tests\": a list of three parameters (circle, triangle, diamond) with arrows fanning out to three columns, each rerunning the same six tests tagged with that parameter's shape — the circle column all passing, the triangle column with three failures, the diamond column with one failure." + +❯ claude -p "Produce a concise alt text for the following image: @image.png" \ + --model sonnet --effort medium --output-format json \ + | jq '.result' +"Alt text: \"Diagram contrasting plain behavioral tests (a single list of pass/fail checks) with parameterized behavioral tests, where one test template is run against multiple parameter sets (circle, triangle, diamond), producing separate pass/fail results for each.\"" + +❯ claude -p "Produce a concise alt text for the following image: @image.png" \ + --model haiku --output-format json \ + | jq '.result' +"Diagram contrasting behavioral tests (list with pass/fail results) vs parameterized behavioral tests (matrix showing same tests run with different parameter shapes, each with pass/fail outcomes)." + +❯ claude -p "Produce a concise alt text for the following image: @image.png" \ + --model fable --effort medium --output-format json \ + | jq '.result' +"Diagram comparing \"Behavioral Tests\" (one column of six test cards, four passing with green checks, two failing with red X's) against \"Parameterized Behavioral Tests\" (a set of three parameters shown as a purple circle, triangle, and diamond, each fanning out into its own column of six test cards, with the circle column all passing and the triangle and diamond columns containing a mix of passes and failures)." +``` + +I was surprised at how concise each of these were. When I was about to run each +of these, I was expecting the results to be closer to what I saw in [_Include A File With Message To `ant`_](include-a-file-with-message-to-ant.md) + +> A hand-drawn style diagram comparing two testing approaches, split by a +> vertical line. +> +> On the left, under the heading "Behavioral Tests," is a single column of six +> rounded rectangular test rows: four outlined in green with green check-mark +> icons (passing) and two outlined in red with red X icons (failing), each +> containing black scribble lines representing text. +> +> On the right, under the heading "Parameterized Behavioral Tests," a bracketed +> list of three purple parameter symbols — a circle, a triangle, and a diamond — +> sits at the top, with arrows pointing down to three separate columns of six +> test rows each. Every row in a column is tagged with its corresponding +> parameter shape on the right edge. The circle column shows all six rows +> passing (green with check marks). The triangle column shows three passing and +> three failing (red with X marks). The diamond column shows five passing and +> one failing. The illustration conveys that a single behavioral test, when +> parameterized, expands into multiple variants whose pass/fail outcomes can +> differ per parameter. + +I guess the "Be concise, _but descriptive_" made a difference.