<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Carolina Herrera</title>
    <description>The latest articles on DEV Community by Carolina Herrera (@carolina_herrera_cdc2e30e).</description>
    <link>https://dev.to/carolina_herrera_cdc2e30e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3762628%2F2e848d11-bea1-403c-937f-848e2f759865.jpg</url>
      <title>DEV Community: Carolina Herrera</title>
      <link>https://dev.to/carolina_herrera_cdc2e30e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carolina_herrera_cdc2e30e"/>
    <language>en</language>
    <item>
      <title>I built an npm package that auto-generates alt text for images using AI</title>
      <dc:creator>Carolina Herrera</dc:creator>
      <pubDate>Mon, 09 Feb 2026 17:53:22 +0000</pubDate>
      <link>https://dev.to/carolina_herrera_cdc2e30e/i-built-an-npm-package-that-auto-generates-alt-text-for-images-using-ai-175d</link>
      <guid>https://dev.to/carolina_herrera_cdc2e30e/i-built-an-npm-package-that-auto-generates-alt-text-for-images-using-ai-175d</guid>
      <description>&lt;p&gt;I got tired of writing alt text manually for hundreds of images, so I built &lt;strong&gt;alt-images-ai&lt;/strong&gt; — an npm package that uses OpenAI or Google Gemini to generate accessible image descriptions automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Every &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag should have an &lt;code&gt;alt&lt;/code&gt; attribute. It's essential for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Screen readers&lt;/strong&gt; — visually impaired users depend on alt text to understand images&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SEO&lt;/strong&gt; — search engines use alt text to index and rank your images&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WCAG compliance&lt;/strong&gt; — missing alt text is one of the most common accessibility violations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But let's be honest — writing good alt text for every image is tedious. Especially when you have dozens (or hundreds) of images across your site.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;alt-images-ai&lt;/code&gt; takes an image (URL, file path, or Buffer) and returns a concise, descriptive alt text using AI vision models.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
bash
npm install alt-images-ai

Basic usage
import { AltImageClient } from "alt-images-ai";

const client = new AltImageClient({
  provider: "gemini",  // or "openai"
  apiKey: process.env.AI_API_KEY,
});

const alt = await client.generateAlt("https://example.com/photo.jpg");
// "Golden retriever running across a sunlit meadow"

Process an entire HTML page
This is the feature I'm most excited about. You can pass a full HTML string and it will find every &amp;lt;img&amp;gt; tag missing an alt attribute and generate one:

const html = `
  &amp;lt;div&amp;gt;
    &amp;lt;img src="hero.jpg"&amp;gt;
    &amp;lt;img src="team.jpg" alt=""&amp;gt;
    &amp;lt;img src="logo.png" alt="Company logo"&amp;gt;
  &amp;lt;/div&amp;gt;
`;

const result = await client.processHTML(html);

Result:

hero.jpg → gets AI-generated alt text
team.jpg → gets AI-generated alt text (empty alt counts as missing)
logo.png → left unchanged (already has meaningful alt)
Batch processing
Need to process multiple images at once? It runs them in parallel:

const { results, errors } = await client.generateAltBatch([
  "https://example.com/img1.jpg",
  "https://example.com/img2.jpg",
  "./local-image.png",
]);

Multi-language
Generate alt text in any language:

const client = new AltImageClient({
  provider: "gemini",
  apiKey: process.env.AI_API_KEY,
  language: "es", // Spanish
});

What I used to build it
TypeScript — full type definitions included
Zero runtime dependencies — only uses Node.js built-in modules (https, fs, path)
Two AI providers — OpenAI (GPT-4o-mini) and Google Gemini (gemini-2.0-flash)
Use cases
Here are some ways you could use it:

Accessibility audits — scan your site's HTML and auto-fix missing alt text
CMS integration — generate alt text automatically when users upload images
E-commerce — describe product images for better accessibility and SEO
Build step — add it to your static site generator pipeline
Migration — bulk-add alt text to legacy HTML pages
Try it out
npm install alt-images-ai

GitHub: github.com/kreent/alt-images-ai
npm: npmjs.com/package/alt-images-ai

Would love to hear your feedback! If you find it useful, a ⭐ on GitHub would mean a lot.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>javascript</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
