---
title: "Using AI Tools to Convert a PDF into Images"
description: "An LLM agent can convert a PDF into JPEG images by planning an ImageMagick `convert` call that runs in a Docker container, so nothing needs to be installed locally."
url: "https://swe.quest/articles/using-ai-tools-to-convert-a-pdf-into-images-7d2ab149efe36a94"
canonical: "https://www.docker.com/blog/using-ai-tools-to-convert-a-pdf-into-images/"
source: "Docker"
published: "2024-11-04"
difficulty: "medium"
kind: "Case study"
reading_minutes: 4
tags: ["ai-agents","containers","developer-tools","llms"]
---

# Using AI Tools to Convert a PDF into Images

A post on [Docker](https://swe.quest/sources/docker.md), published 2024-11-04, 4 min read, Case study. Original: [https://www.docker.com/blog/using-ai-tools-to-convert-a-pdf-into-images/](https://www.docker.com/blog/using-ai-tools-to-convert-a-pdf-into-images/)

## Summary

An LLM agent can convert a PDF into JPEG images by planning an ImageMagick \`convert\` call that runs in a Docker container, so nothing needs to be installed locally. Tools are defined in Markdown prompt files, distributed through Docker Hub and pulled from nixpkgs. Rather than hand-designing interfaces for each tool, the agent loops through running the tool, capturing errors, reading the tool's own documentation and retrying. One packaging gap, a missing Ghostscript dependency, still had to be fixed by hand in the image build.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- Docker basics ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- LLM tool calling ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

Docker, ImageMagick, Ghostscript, nixpkgs, Docker Hub, Docker Labs GenAI

## Related posts

- [Getting Started with the Labs AI Tools for Devs Docker Desktop Extension](https://swe.quest/articles/getting-started-with-the-labs-ai-tools-for-devs-docker-desktop-extension-82e61806b7468ca8.md): Docker · 2024-09-09 · Medium · 4 min read · AI agents, LLMs, Containers, Developer tools
  The Labs AI Tools for Devs Docker Desktop extension runs LLM prompts against local projects.
- [Using an AI Assistant to Read Tool Documentation](https://swe.quest/articles/using-an-ai-assistant-to-read-tool-documentation-3a8f1d86f339e727.md): Docker · 2024-09-23 · Medium · 7 min read · AI agents, LLMs, Containers, Developer tools, RAG & retrieval
  LLM agents can learn unfamiliar command-line tools by reading their documentation and reacting to Unix error signals.
- [How to Create Dockerfiles with GenAI](https://swe.quest/articles/how-to-create-dockerfiles-with-genai-c43e5eb0c85107c1.md): Docker · 2024-07-29 · Medium · 7 min read · AI agents, Containers, LLMs, Developer tools
  Framing Dockerfile generation as an interaction between an LLM and tools, rather than a chat where the user supplies project details, produces much better results.
- [A PDF is not a string](https://swe.quest/articles/a-pdf-is-not-a-string-2f4d2c0ae6496a1b.md): Render · 2026-08-06 · Medium · 4 min read · Data pipelines, AI agents, System design, LLMs
  Document ingestion for agents breaks because PDFs carry no structural markup, so naive text extraction scrambles multi-column layouts and tables, and frontier models lose accuracy on visual structure while returning flat text with no bounding boxes, confidence or provenance.
- [Build a Recipe AI Agent with Koog and Docker](https://swe.quest/articles/build-a-recipe-ai-agent-with-koog-and-docker-5af82c75d41ec7f4.md): Docker · 2025-08-08 · Medium · 12 min read · AI agents, Java & JVM, Containers, LLMs
  A small Kotlin AI agent built with JetBrains' Koog framework can run entirely on a local model served by Docker Model Runner, wired up through Docker Compose's agentic models feature.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
