|
| 1 | +--- |
| 2 | +title: "Generate Images with Claude and Hugging Face" |
| 3 | +thumbnail: /blog/assets/claude-and-mcp/thumbnail.png |
| 4 | +authors: |
| 5 | +- user: evalstate |
| 6 | +--- |
| 7 | + |
| 8 | +# Generate Images with Claude and Hugging Face |
| 9 | + |
| 10 | +> [!TIP] |
| 11 | +> **TL;DR:** It's easier than ever to generate detailed pictures with state-of-the-art AI models by connecting Claude to Hugging Face Spaces. This article describes how and why, and introduces recently launched models which excel at producing natural images or images that include text. |
| 12 | +
|
| 13 | +## Introduction |
| 14 | + |
| 15 | +Recent advances in image generation models have improved their ability to produce realistic outputs and incorporate high quality text. It's easier than ever to use these models by connecting them directly to Claude. |
| 16 | + |
| 17 | +The advantages of generating pictures this way are: |
| 18 | + - The AI can assist in building detailed prompts that may improve the quality of generated images. |
| 19 | + - The AI can "see" the generated images, then help iterate on designs and techniques to get perfect results. |
| 20 | + - You can easily swap in the latest models or the one best suited for your needs. |
| 21 | + |
| 22 | +To get started, create a free [Hugging Face account](https://huggingface.co/join), then connect Claude from its "Search and tools" menu in the chat input box. The video below shows the exact steps needed: |
| 23 | + |
| 24 | +<figure class="image flex flex-col items-center text-center m-0 w-full"> |
| 25 | + <video |
| 26 | + alt="claude-auth-flow.mp4" |
| 27 | + autoplay loop autobuffer muted playsinline |
| 28 | + > |
| 29 | + <source src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/claude-images-mcp/claude-auth-flow.mp4" type="video/mp4"> |
| 30 | + </video> |
| 31 | + <figcaption>Connecting Claude to Hugging Face</figcaption> |
| 32 | + </figure> |
| 33 | + |
| 34 | +Behind the scenes Claude is now set up to use tools from the [Hugging Face MCP Server](https://huggingface.co/mcp?login), seamlessly extending it's capabilities. This includes the latest AI Applications running on our innovative [ZeroGPU](https://huggingface.co/docs/hub/spaces-zerogpu) powered Spaces. Your Hugging Face account provides free credits to use these large, powerful models. |
| 35 | + |
| 36 | +After Claude has been connected with Hugging Face, we'll show how to configure image generation tools that Claude can use. |
| 37 | + |
| 38 | +## Natural Images with Flux.1 Krea Dev |
| 39 | + |
| 40 | +[FLUX.1 Krea [dev]](https://huggingface.co/black-forest-labs/FLUX.1-Krea-dev) aims to eliminate the telltale "AI look" that often plague generated images - for example plastic skin, oversaturated colors, or overly smooth textures. If you want images that look like they were shot by a professional photographer rather than generated by a computer, Krea delivers the realistic textures, natural lighting, and authentic aesthetics that other AI models struggle with. You can read more about how they did this [on their blog](https://www.krea.ai/blog/flux-krea-open-source-release). |
| 41 | + |
| 42 | +<figure class="image text-center"> |
| 43 | + <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/claude-images-mcp/bfl_krea_image_wide.avif" alt="Examples from Krea"> |
| 44 | + <figcaption>Examples from the Krea Image Generator</figcaption> |
| 45 | +</figure> |
| 46 | + |
| 47 | +To use **Krea** with Claude, go to [`huggingface.co/mcp/settings`](https://huggingface.co/settings/mcp) and add `mcp-tools/FLUX.1-Krea-dev` to your "Spaces Tools". That's all you need to enable Claude to generate beautiful, realistic looking images. |
| 48 | + |
| 49 | +<figure class="image flex flex-col items-center text-center m-0 w-full"> |
| 50 | + <video |
| 51 | + alt="adding-mcp-space.mp4" |
| 52 | + autoplay loop autobuffer muted playsinline |
| 53 | + > |
| 54 | + <source src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/claude-images-mcp/adding-mcp-space.mp4" type="video/mp4"> |
| 55 | + </video> |
| 56 | + <figcaption>Adding a Space in <a href='https://huggingface.co/settings/mcp'>MCP Settings</a></figcaption> |
| 57 | + </figure> |
| 58 | + |
| 59 | + |
| 60 | +You can then try a prompt in Claude like: |
| 61 | + |
| 62 | +> "Use Krea to create an image of a vibrant garden with victorian house". |
| 63 | +
|
| 64 | +To begin generating pictures. |
| 65 | + |
| 66 | +## Qwen Image |
| 67 | + |
| 68 | +[Qwen-Image](https://huggingface.co/Qwen/Qwen-Image) is a powerful AI image generator that excels at following prompts and accurate text rendering, making it ideal for designing posters, signs, infographics, and marketing materials where text quality matters. Read more about the Qwen-Image model from their [blog post](https://qwenlm.github.io/blog/qwen-image/). |
| 69 | + |
| 70 | +<figure class="image text-center"> |
| 71 | + <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/claude-images-mcp/qwen_sample.jpg" alt="Examples from Qwen"> |
| 72 | + <figcaption>Examples from the Qwen-Image Generator</figcaption> |
| 73 | +</figure> |
| 74 | + |
| 75 | +To use **Qwen-Image** add `mcp-tools/qwen-image` from your [MCP Servers setting](https://huggingface.co/settings/mcp) page, then check it is enabled in Claude to start using it. |
| 76 | + |
| 77 | +Qwen-Image comes with a Prompt Enhancer that helps write detailed prompts suitable for it. To try it, select "Qwen Prompt Enhancer" from the prompts menu and enter your idea before submitting it to Claude. |
| 78 | + |
| 79 | +<figure class="image flex flex-col items-center text-center m-0 w-full"> |
| 80 | + <video |
| 81 | + alt="qwen_image_prompt.mp4" |
| 82 | + autoplay loop autobuffer muted playsinline |
| 83 | + > |
| 84 | + <source src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/claude-images-mcp/qwen_image_prompt.mp4" type="video/mp4"> |
| 85 | + </video> |
| 86 | + <figcaption>Using the Qwen Prompt Enhancer from Claude</a></figcaption> |
| 87 | + </figure> |
| 88 | + |
| 89 | +You can even keep both Krea and Qwen-Image enabled and ask Claude to use both so you can compare results. For example: "Use Krea and Qwen to generate a street scene with 'Hugging Face' graffiti sprayed on the wall". |
| 90 | + |
| 91 | +<figure class="image text-center"> |
| 92 | + <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/claude-images-mcp/krea_hf_example.webp" alt="Hugging Face Graffiti Street Scene"> |
| 93 | + <figcaption>Hugging Face Graffiti Street Scene</figcaption> |
| 94 | +</figure> |
| 95 | + |
| 96 | + |
| 97 | +## Conclusion |
| 98 | + |
| 99 | +Connecting Claude to Hugging Face Spaces makes using state-of-the-art models as easy as clicking a button, even the day new models are released. Explore the AI App Directory at [https://huggingface.co/spaces](https://huggingface.co/spaces) and build amazing projects with [Video Generation](https://huggingface.co/spaces/Lightricks/ltx-video-distilled), [Web Search](https://huggingface.co/spaces/victor/websearch), [Image Editing](https://huggingface.co/spaces/mcp-tools/FLUX.1-Kontext-Dev) and many thousands more. With a [Pro account](https://huggingface.co/pro) you get increased usage limits and more. Let us know what you find and create in the comments below! |
0 commit comments