What is AI image generation?

Artificial intelligence (AI) image generators can produce detailed images in a variety of styles based on large sets of training data.

Learning Objectives

After reading this article you will be able to:

  • Understand how AI image generation works
  • Describe neural networks and generative adversarial networks
  • Learn how Cloudflare helps developers build AI image generators

Copy article link

How does AI image generation work?

Artificial intelligence (AI) image generation is a type of generative AI for producing visual content. It uses mathematical analysis to identify and duplicate patterns within photos and illustrations. In simpler terms, AI image generators create images based on a set of examples.

AI image generators are built on a specialized type of machine learning model called a neural network. Via the use of advanced statistical analysis, along with some fine-tuning on the part of the developer, image generators can produce relevant, detailed images in a variety of styles.

Rather than an artist with a paintbrush, an AI image generator is more like a gambler placing bets on probable sporting outcomes. The content it produces is statistically likely to fulfill the request that it received. And, its created content is based on preexisting content, just as the gambler might examine athletes' past performances before placing their bet.

AI image generators can create realistic-seeming photographs. They can also edit preexisting images. Like other types of generative AI, AI image generation models can interpret natural-language prompts and create images in response. "Make an image of an elephant" is a valid prompt — although such a prompt may need to be refined before it produces the image that the prompter has in mind.

What is generative AI?

Generative AI is a category of deep learning model that produces text, images, computer code, audio, or visual content. As a type of machine learning, it relies on mathematical and statistical analysis of sample data sets in order to produce content that is statistically likely to be relevant in response to prompts. In other words, generative AI quickly makes content based on past examples it has seen.

What technology is behind AI image generation?

As described above, AI image generation is constructed using machine learning, a class of advanced computer programs that can learn without definite instructions. Specifically, AI image generation is built on neural networks.

A neural network is a type of deep learning computing architecture. Essentially, neural networks aim to mimic the structure of a human brain. They are a collection of processing units called "nodes." The nodes pass data to each other, similar to the way that a human brain works, with neurons sending electrical impulses to each other.

There are many different classes of neural networks in the field of AI. The specific kind of neural network used by most image generating AI models is called a generative adversarial network (GAN). A GAN has two workstreams: one produces images, and the other compares those images to real-life examples and identifies errors. Thus a GAN-based model is able to train itself and continually improve. Think of a painter who learns by imitating famous paintings of the past and comparing their work against the real pieces.

How does AI image generation differ from other types of generative AI?

While the same or similar algorithms may be used across types of generative AI, image generating models are trained on sets of visual images, as opposed to large amounts of text, like ChatGPT and other large language models (LLMs).

What are AI image hallucinations?

AI hallucinations can occur with any type of generative AI model, and image-generating AI is no exception. These show up as inaccuracies in the image: for instance, if asked to generate a portrait of a person, an extra finger appears on the hand of the subject. With sufficient prompting and refining, it is usually possible to remove these hallucinations.

Are AI-generated images copyrighted?

Any human-produced creative work is under copyright, unless the creator either waives the copyright or the copyright has expired. Rights to a work can be transferred or sold to other parties via a license.

Image licenses fall into several tiers:

  • Royalty-free: These images can be used in any way after a one-time payment to the rights owner.
  • Copyright-free: Such an image has been released to the public and can be used by anyone for any purpose without crediting the creator.
  • Public domain: A creative work is in the public domain if the copyright has expired. Anyone can use public domain images for any purpose. Works enter the public domain at different times in different jurisdictions, so the international use of public domain images can be tricky.
  • Creative Commons: There are six different types of license under this category. All allow for widespread use of the image but not all allow for commercial use or modification. Creative Commons licenses all require credit to the creator of the image.

AI-generated images are not protected by copyright law since a human does not create them. Therefore, such images usually enter the public domain.

The problem, however, is that the training data set upon which a model draws may contain images with a range of licenses, and may also contain protected intellectual property. If an AI image generator produces an image very similar to a preexisting image by a human creator, or to a brand owned by another company, those parties may sue someone who uses the image. (For example, an AI-generated image of Superman may still be protected by the same legal protections that apply to official images of the character.)

Can you use AI-generated images commercially?

For AI-generated images, this depends on the license and on the image-generating service used. Some AI generation services have trained their models on a curated collection of images for which they have the rights. Such services may allow for commercial use of the images generated by their services under a Creative Commons license — which means anyone else could also use the images. This complicates commercial use, as the images cannot be protected from use by competitors in the way original images, brands, or trademarks can be.

How does Cloudflare help developers build their own AI image generators?

Cloudflare Workers AI provides full-stack AI building blocks, allowing developers to integrate a multitude of popular generative AI models into their applications and run them on a global network of GPUs. View this tutorial to learn how to get started with building AI image generators.