Hello Drupal fanatics! Welcome to “Drupal & AI Adventures. In this series, we explore the fantastic world of Drupal modules powered by artificial intelligence. Our mission? We want to inspire and enlighten YOU. We'll dive in together! This time we're talking about Image Generation. How can we use AI to generate images in a CMS setting.

Robot generates image

Image generation?

How exactly does that work? There are two (major) types of Image Generation AIs. 

1 The GAN (Generative Adversarial Networks) way works with a Generator and a Discriminator. The Generator generates fake images. The Discriminator looks at the image and says: real or fake. If the Generator can generate an image that the Discriminator cannot distinguish from fake, you have generated a good image. The better the Discriminator can distinguish fakes, the better the output.

2 Diffusion Models. These generate an image by scattering pixels and systematically converting noise into structured images. 

The prompt is also interpreted with an NLP, a vector is created from it which will later be used as a rulebook to see that all necessary elements are present and if they interact with each other (e.g. apple under tree, apple on head).

 

Did you know?

Did you know that there are two (major) flows to generate images? 

  • Diffusion (from pixel noise each time more and more to an image)
  • Generative Adversarial Networks with a Generator and a Discriminator
Diffusion model

Diffusion model

Brussels atomium thirties style AD

Generate images, right where you need it

AI image generation can be done from your favorite CMS, right from your WYSIWYG editor.

Bing (that search engine we all collectively ignore) generated images are usually of very high quality.
Jeroen Baert

Notes on Drupal modules

 

 

ai_image

This module gives editors from the WYSIWYG the power of image generation in content (see screenshot atomium). The module has support for following image generation models: 

  • Stability's Stable diffusion 
  • Openai's DALL-E

openai_image_for_drupal

This module adds an additional widget that generates an image based on input. You can then immediately save the image in the asset library and use it in your content.

Supports only the following model: 

  • Openai's DALL_E

openai_images

This module offers an Admin page to enter prompts. After generating the image, you can then add it to the asset library. 

Module supports only: 

  • Openai's DALL-E

ai_interpolator_dreamstudio

This module actually fits into the AI interpolator ecosystem (read the blog post about AI interpolator LINK). It uses Stable diffusion (Stability.ai) and can generate images 

  • based on text
  • based on an image uploaded by an editor