Skip to main content
The gRPC API is in legacy maintenance mode and won’t receive new features. For new projects, use the REST v2beta API.
Image variants are a powerful way to create alternative versions of a past generation. By generating an image and then passing that image in as part of an Image-to-Image request, we can create as many variations on the initial idea as we’d like. Try it out live by clicking the link below to open the notebook in Google Colab! Open In Colab

Python Example

1. Install the Stability SDK package…

2. Import our dependencies and set up our environment variables and API Key…

3. Establish our connection to the API…

4. Set up initial generation parameters, save image on generation, and warn if the safety filter is tripped…

Resulting image written to <seed>.png:

Initial generation.

5. Set up an initial image based on our previous generation settings and generate variations based on it…

By changing only the seed we can use our previous generation as a base for our new variations.

Resulting images written to <seed>.png:

Final variants. Note: This is not representative of all of the parameters available for image generation. Please check out our protobuf reference for a complete list of parameters available for image generation.