How to use Stable Diffusion 3 to generate a similar image.

Stable Diffusion 3 from Stability AI has now been released and is available for public use. However, they currently only offer a REST API to test these models. Therefore, I tried using this on my local machine using Node.js code.

import fs from "node:fs";
import axios from "axios";
import FormData from "form-data"; const formData = { prompt: "prompt", output_format: "png", aspect_ratio: "16:9", seed: "645,508,968",
}; const response = await axios.postForm( `https://api.stability.ai/v2beta/stable-image/generate/sd3`, axios.toFormData(formData, new FormData()), { validateStatus: undefined, responseType: "arraybuffer", headers: { Authorization: `TOKEN`, Accept: "image/*", }, },
); if (response.status === 200) { fs.writeFileSync("./output.png", Buffer.from(response.data));
} else { throw new Error(`${response.status}: ${response.data.toString()}`);
}
Enter fullscreen mode
Exit fullscreen mode

If you prefer testing it without code, you can check and use your token wisely. https://fireworks.ai/models/stability/sd3

To generate a similar image, we need to utilize the seed parameter; using the same seed will produce similar images.

Here, I’m trying to create a prompt for a countryside scene across four seasons and also a picture with a weather ambience vibe, where the result is not exactly the same but produces a similar output in terms of how the landscape looks.

Generating Similar Image (4 different season)

seed -> 645,508,968

Spring Prompt

A countryside village with a clear blue sky, surrounded by sakura trees, in an anime art style.

A countryside village with a clear blue sky, surrounded by sakura trees, in an anime art style.

Summer Prompt

A countryside village with a clear blue sky, surrounded by green trees, in an anime art style.

A countryside village with a clear blue sky, surrounded by green trees, in an anime art style.

Autumn Prompt

A countryside village with a clear blue sky, surrounded by trees that are falling down in the autumn season, in an anime art style.

A countryside village with a clear blue sky, surrounded by trees that are falling down in the autumn season, in an anime art style.

Winter Prompt

A countryside village with a clear blue sky, surrounded by a snow, in an anime art style.

A countryside village with a clear blue sky, surrounded by a snow, in an anime art style

Generating Similar Image (ambience vibes)

Seed -> 358,804,591

Default Prompt

In a dark alley illuminated by a neon light, the scene exudes Tokyo city vibes. It’s foggy and ultra-realistic in 4K resolution. A cat, not facing the camera, sits in the middle of the alley street, with a bokeh focus on the cat. A vending machine is mounted on the wall.

In a dark alley illuminated by a neon light, the scene exudes Tokyo city vibes. It's foggy and ultra-realistic in 4K resolution. A cat, not facing the camera, sits in the middle of the alley street, with a bokeh focus on the cat. A vending machine is mounted on the wall.

Snow Ambience Prompt

In a dark alley illuminated by a neon light, the scene exudes Tokyo city vibes. It’s foggy and ultra-realistic in 4K resolution, with a snowstorm and a thick layer of snow covering the street. A cat, not facing the camera, sits in the middle of the alley street, with a bokeh focus on the cat. A vending machine is mounted on the wall.

In a dark alley illuminated by a neon light, the scene exudes Tokyo city vibes. It's foggy and ultra-realistic in 4K resolution, with a snowstorm and a thick layer of snow covering the street. A cat, not facing the camera, sits in the middle of the alley street, with a bokeh focus on the cat. A vending machine is mounted on the wall.

Rain Ambience Prompt

In a dark alley illuminated by a neon light, the scene exudes Tokyo city vibes. It’s foggy and ultra-realistic in 4K resolution, with a heavy rainstorm creating a muddy environment. A cat, not facing the camera, sits in the middle of the alley street, sharply in focus with a bokeh effect. A vending machine is mounted on the wall.

In a dark alley illuminated by a neon light, the scene exudes Tokyo city vibes. It's foggy and ultra-realistic in 4K resolution, with a heavy rainstorm creating a muddy environment. A cat, not facing the camera, sits in the middle of the alley street, sharply in focus with a bokeh effect. A vending machine is mounted on the wall.

Summary

While the output for each image is not exactly the same, it already has the same landscape structure if we use the same seeds and a similar prompt, with some customization added to create a new scene or ambiance.

Resources

All the images here were generated by Stable Diffusion 3, including the cover image.


Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top
Us amd epyc servers. Clustered hosting platform get a host.