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.
Initial images (aka: ‘init’ images) are a powerful tool for generating or modifying new images based on a starting point. Also known as Image-to-Image, we’ll show you how to use the gRPC API to generate an image, and then further modify that image as our initial image with a prompt.
Try it out live by clicking the link below to open the notebook in Google Colab!Open In Colab

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…

Initial generation.

5. Set up an initial image based on our previous generation, and use a prompt to convert it into a crayon drawing…

Resulting image written to <seed>.png:

Final result.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.