---
title: "IMG Processing AI Features"
date: "2024-10-02"
description: "Use the IMG Processing API for AI: generate images with Stable Diffusion, classify them with ResNet 50, ask LLaVA questions about a picture, remove backgrounds."
tags: ["IMG Processing", "Artificial Intelligence"]
url: "https://rolandoandrade.me/blog/img-processing-ai-features/"
author: "Rolando Andrade"
---

# IMG Processing AI Features

> Use the IMG Processing API for AI: generate images with Stable Diffusion, classify them with ResNet 50, ask LLaVA questions about a picture, remove backgrounds.

In this tutorial, one cat goes through every AI feature of **[IMG Processing](/projects/img-processing/)**. We create the cat with AI, ask the AI what it is, write a caption for it and remove its background.

In the last two posts about IMG Processing, I showed you how to use the API with the [HTTP endpoints](/blog/presenting-img-processing/) and with the [Node.js SDK](https://blog.rolandoandrade.me/experimenting-with-the-img-processing-sdk/). Today, let's look at the AI features and how to use them.

![One cat, four AI endpoints](https://storage.rolandoandrade.me/blog/img-processing-ai-features-cat-pipeline.webp)

## Create an account first

The first step is to create an account.

[IMG Processing](https://img-processing.com/): IMG Processing - Image Processing API. A picture is worth a thousand words. Integrate powerful image processing capabilities into your applications in minutes

As soon as you sign up for the IMG Processing API, you get a test API key. An API key is a secret code that lets you make requests to the API.

## Generate an image

Now that we have an API key, the first AI feature is image generation. It uses **Stable Diffusion**, a model that creates images from text. It performs well, and it competes in quality and price with almost every solution on the internet, like **DALL-E 3** and **Midjourney**.

![Cat image created using the IMG Processing imagine endpoint](https://storage.rolandoandrade.me/blog/cat-generated-image.webp)

The endpoint to generate images is `/v1/images/imagine`. It receives a name, a prompt and an inverse prompt. The prompt describes what you want. The inverse prompt describes what you do not want. Try it with your favorite tool or directly on the playground:

[Imagine Image - IMG Processing](https://docs.img-processing.com/api-reference/endpoints/creation/imagine): Creates a new image using AI

![](https://storage.rolandoandrade.me/blog/imagine-playground.webp)

We can check the new image with the [download](https://docs.img-processing.com/api-reference/endpoints/access/download) endpoint or in the dashboard:

![](https://storage.rolandoandrade.me/blog/imagine-dashboard.webp)

As you can see, it generated a cat image of 1024x1024 pixels.

## Ask what is in the image

To add labels to an image, or to find out what it shows, use the endpoint `/v1/images/{imageId}/classify`. It uses `ResNet-50`, an image recognition model. It sorts an image into one of 1000 labels with high accuracy.

[Image Classification - IMG Processing](https://docs.img-processing.com/api-reference/endpoints/analysis/classify): Classifies the image giving a list of labels and their probabilities

![](https://storage.rolandoandrade.me/blog/classify-result.webp)

We gave it the cat we generated with AI. It identified the cat as a Tabby with a score of 62%, which is correct. The downside of this model is its limit of 1000 labels. The world has many more things than that.

For more complex images, you may prefer a newer model like **Uform-Gen** or **LLaVA**. With these models, you can ask questions about an image and get answers. For example, we can ask the AI what the image shows with the endpoint `/v1/images/{imageId}/visualize`.

[Visualize Image - IMG Processing](https://docs.img-processing.com/api-reference/endpoints/analysis/visualize): Answer a prompt based on the content of an image.

![](https://storage.rolandoandrade.me/blog/visualize-result.webp)

We asked the AI `In a single word. What is featured in this image?`, and it answered correctly with `cat`. From here, it is up to your imagination. You can use it in any way you like. For example, let's use it to write a caption:

![](https://storage.rolandoandrade.me/blog/visualize-caption.webp)

Awesome, isn't it?

## Remove the background

Background removal is one of the main features of IMG Processing. It is one of the best on the internet in quality and price. It costs 50 times less than tools like **RemoveBG**, and the results are awesome. Let's see it:

[Remove Image Background - IMG Processing](https://docs.img-processing.com/api-reference/endpoints/edition/remove-background): Remove the background from an image.

![](https://storage.rolandoandrade.me/blog/remove-bg-playground.webp)

As you can see, it returned a PNG image. Let's download it:

![](https://storage.rolandoandrade.me/blog/remove-bg-download.webp)

Nice, the download worked. Here is the result:

![](https://storage.rolandoandrade.me/blog/remove-bg-result.webp)

That is it. We removed the background of the image in an easy, fast and cheap way.

## What comes next

These are all the AI features available right now. I have plans for more:

1. A background blur effect, using the separate layers I already get from background removal.
2. Better OCR, which reads text in images. The `visualize` endpoint works okay, but it hallucinates, which means it sometimes makes things up.
3. More models for classification, image generation and background removal.
4. Image variations, and more.

For now, thanks for reading, and I hope you enjoy this tutorial!

* * *

If you enjoy the content, please don't hesitate to subscribe and leave a comment! I would love to connect with you and hear your thoughts on the topics I cover.

[Book a call with Rolando](https://rolandoandrade.me/pricing/)
