A vision LLM can parse a PDF, and it’s the only parser that reads the pictures. Kezhan Shi’s article on Towards Data Science adds a vision LLM parser alongside the fitz, Azure Layout and Docling engines: render the page to an image, send it in one structured call, and get the page back as markdown plus one entry per figure with a kind, a description, and a transcription.
The description is the part nothing else produces. A chart has no characters, so OCR and layout engines hand you a bounding box and move on, and retrieval never sees that region. A vision model writes a sentence like “commodity price indices by sector, falling since their 2022 peak”, and that page now matches a search about commodity prices.
Where does vision parsing break?
In two ways. Values read off a curve are approximate, so treat a transcribed number as something to verify against the source. Omission is worse because it is silent: gpt-4o-mini found three of six charts on a World Bank page and called two of them tables, while gpt-4.1 found all six with axes down to the month. Deterministic parsers never drop a row, but a cheaper vision model fails on the exact thing you brought vision in to do, so the model you pick matters.
One guard from the article is worth copying. Its lighter mode, answer_from_pdf_vision, gives the schema an answer_found false path, so a question whose answer is not on the page returns nothing instead of a plausible invention. Keep that exit in any structured output you build.
How does this map onto a WordPress media library?
Almost one to one. _wp_attachment_image_alt and the FigureContent.description field are the same contract: one short sentence, in searchable words, about what an image shows. Media libraries full of product photos with empty alt fields are common, and nobody writes those sentences by hand. Alt text is also what a screen reader reads aloud, so it has to describe the image, and keyword stuffing makes that worse.
A minimal version for a single attachment:
function bbioon_set_alt_from_vision( int $attachment_id, string $api_key ): bool {
$image_url = wp_get_attachment_url( $attachment_id );
$body = array(
'model' => 'gpt-4.1',
'messages' => array(
array(
'role' => 'user',
'content' => array(
array( 'type' => 'text', 'text' => 'Write one short alt text sentence for this image. If nothing is legible, return an empty string.' ),
array( 'type' => 'image_url', 'image_url' => array( 'url' => $image_url ) ),
),
),
),
);
$res = wp_remote_post(
'https://api.openai.com/v1/chat/completions',
array(
'headers' => array(
'Authorization' => 'Bearer ' . $api_key,
'Content-Type' => 'application/json',
),
'timeout' => 30,
'body' => wp_json_encode( $body ),
)
);
if ( is_wp_error( $res ) || 200 !== wp_remote_retrieve_response_code( $res ) ) {
return false;
}
$data = json_decode( wp_remote_retrieve_body( $res ), true );
$alt = sanitize_text_field( trim( $data['choices'][0]['message']['content'] ?? '' ) );
if ( '' === $alt ) {
return false; // model had nothing legible, skip instead of guessing
}
update_post_meta( $attachment_id, '_wp_attachment_image_alt', $alt );
return true;
}
Two cautions. Queue it with Action Scheduler or a CLI script instead of running it over the whole library in one request, and store which model wrote each sentence so you can regenerate them later. Keep the empty string path meaningful, because a model that always returns something will invent a description for a blank image. (SVG attachments fail here, since the API wants raster input.)
If your store is sitting on a library of unlabeled product photos, this batch job is the kind of work I do. Run the count below first, and if the number is big we can talk about whether the per-image cost is worth it.
When is vision LLM PDF parsing worth the cost?
When the cheap parsers come back empty. The article’s rule is vision for the pages the textual engines go blind on. That’s the same split I use when I split PDF parsing into a cheap pass and a heavy pass: text extraction first, then a model call only for pages that are mostly pictures, degraded scans, or images with no text at all.
The price is per page, and you lose positions. Every vision page is a rendered image plus a model call, and the output has no bounding boxes, so anything that highlights the source line on the PDF stops working. Mistral Document AI, which packages the same pattern, has the same gap. OpenAI’s images and vision guide covers the input side.
One step for today: run wp db query "SELECT COUNT(*) FROM wp_posts p LEFT JOIN wp_postmeta m ON m.post_id = p.ID AND m.meta_key = '_wp_attachment_image_alt' WHERE p.post_type = 'attachment' AND (m.meta_id IS NULL OR m.meta_value = '')" against the site and look at the number. That’s how many images search engines and screen readers are currently guessing about, and that number decides whether this is a weekend script or a budget line.