---
url: 'http://workflows-of-ai.com/blog/header-image-generation'
title: 'Header Image Generation'
author:
  name: 'Marcus Johansson'
  url: 'http://workflows-of-ai.com/about/marcus-johansson'
date: '2023-10-15T16:06:23+02:00'
updated: '2026-10-10T12:14:04+02:00'
type: article
summary: 'Generate a header image for a Drupal article: OpenAI writes an image description from the text and DreamStudio creates the picture.'
tags:
  - 'Marcus Johansson'
  - Workflows
  - 'Drupal AI'
image: 'http://workflows-of-ai.com/sites/default/files/previews/92034ff39cc7852f.jpg'
published: true
og:
  site_name: 'Workflows of AI'
  'image:width': '1280'
  'image:height': '720'
  'image:alt': 'Header Image Generation'
---
Drupal AI

# Header Image Generation

Have OpenAI describe an image for each article and DreamStudio paint it, so every post gets a header image.

  Marcus Johansson

October 15, 2023 · 1 min read

 ## About this video

An article's transformation into a visual representation begins with utilizing the AI Interpolator OpenAI module. The text of the article is fed into this module, and OpenAI's algorithms analyze it to create a comprehensive image description. This description encapsulates the core themes and elements of the article, providing a detailed visualization prompt.

This image description is then used as a prompt for the AI Interpolator DreamStudio module. DreamStudio takes the detailed description and, leveraging its image generation capabilities, creates a visual representation that aligns with the themes and content of the article. The generated image serves as a visually appealing and relevant header, enhancing the article's presentation and engagement for readers.

*This video is from before the AI Interpolator module became AI Automators, part of the [AI module](https://www.drupal.org/project/ai). Module and menu names have changed since, and some steps look different today.*

## Watch the video

[Watch on YouTube: Header Image Generation](https://www.youtube.com/watch?v=_KkSB7rl21E)

### Video chapters

- 0:00 Why generate header images
- 1:43 Adding the image description field
- 2:32 Writing the OpenAI prompt
- 4:30 The DreamStudio image field
- 5:32 The generated pound cake image

## Transcript

YouTube's automatic captions, lightly corrected. Click a line to jump to that moment in the video.

### Transcript

- 0:01 hey there Marcus uh the next uh video I'm going to show you in tutorial is basically how to set up a hitter image in h how to generate a header image for an article in Drupal uh so this is a
- 0:14 typical CMS use case I would say if you want to generate images in general with Midjourney or Stable Diffusion or something just use those tools because you get previews and it's it's a lot
- 0:26 more uh flexible but say that you have the use case you have a CMS and maybe you have hundreds of articles that you you need some kind of preview image for and it's a generic topic like in this
- 0:40 case I created Article uh it's basically a recipe for traditional pound cake I haven't created sorry I've copied it from just some website just to show show what you can do here
- 0:53 um as always this is Drupal content management framework very powerful open source um on top of that is the AI interpolator modules if you want to learn more about both of them how to set
- 1:05 it up you can look in the the description of this video everything is open source everything is free uh free as bear and you know just uh just download it after this presentation
- 1:22 and you can set up this yourself it requires in this case a DreamStudio account so that's basically a API service for Stable Diffusion and this of course costs money but I think if you
- 1:34 register you get like 100 image generations for free or something like that so we start with logging in uh and then we go to our content type which is the article where we already
- 1:48 have article and now we want to add h a header image then but uh before we do that what we're going to do is we're going to create a text plain long I guess we can use and
- 2:05 basically call that image description because of course we can't generate a head header image on a prompt that's uh the whole recipe that makes no sense it it has no clue what it would
- 2:19 have to generate then uh and more importantly it wouldn't actually uh fit into the prompt space of of uh Stable Diffusion and in this case we're going to enable the AI interpolator we're
- 2:34 going to use OpenAI string long so we're going to take from one text and create another text uh base mode because we only need one source which is the article then so
- 2:46 based on the this is our prompt now then based on the context generate uh Visual and descriptive text of a a header image that could represent this text don't make it longer than one
- 3:19 sentence be very descriptive um and uh visual in your text I write this two times more or less now but it's better to make sure that it tries to create something that can be used to
- 3:39 describe an image and then we just copy the context uh we're going to use GPT 4 for this uh we can use 100 we can use now we use batch because we need to generate
- 3:53 image as well uh you are an assistant making up image descriptions that fits for all so this is the role it's going to play now then makes imag fits for uh image descriptions from longer
- 4:20 texts up short shorter P image descriptions uh keep OpenAI moderation on uh then we're going to create the image field then and this is just the image field we call it header
- 4:41 image just one image and uh we're just going to enable the AI interpolator here and we're going to use the DreamStudio image generator in this case we're going to generate one base
- 4:55 mode and we're going to use the image description as content text then right so and we use that as the prompt context and we can add realistic well you can choose your your
- 5:09 type of style you want here and we want short depth of field because that's something food bloggers often do when they photograph uh take photos of their food uh under advanced settings we have
- 5:24 to set this to 10 1001 and we set batch mode and we can take a new Stable Diffusion engine maybe 2.0 save this and now if we go to our content and save it hopefully image
- 5:40 description and the image would be filled out now then or generated I would say with Stable Diffusion you you should rather use the pixel B module and get realistic images
- 5:51 I will create one for DALL-E 3 now and they that is starting to create really realistic images which makes sense but here well we can watch the article view instead so we can get the image so
- 6:06 basically this generated this description an indulg it in Rich buttery pound cake with a dense velvety crumbs HT with homemade whipped cream and fresh fruit we generated this image then which
- 6:18 is well it's okay I guess um yep that's this workflow thank you for watching

  Filed under [Workflows](/blog?category=6) [Drupal AI](/blog?category=2)

Parts of this content were produced by AI.

This site has not assessed whether a label is required for this content.

  How was AI used?The video and the introduction are Marcus's own, first published on workflows-of-ai.com. AI wrote the subtitle, the summary and the video chapters from the transcript, and corrected misheard names in YouTube's automatic captions.

   Marcus Johansson

Tinkers with AI and Drupal

 [About Marcus](/about/marcus-johansson)[Drupal.org profile](https://www.drupal.org/u/marcus_johansson)[Drupal AI](https://www.drupal.org/project/ai)

## The post in three sentences

A plain text field uses OpenAI to write a one-sentence visual description of the article, since the full text would not fit a Stable Diffusion prompt. An image field then sends that description to DreamStudio with a realistic style and short depth of field. The example turns a pound cake recipe into a food photo.