Style Transfer
Style Transfer applies visual characteristics from reference style images to target images. While Style Guide extracts stylistic elements from an input image (control image) and uses it to guide the creation of an output image based on the prompt, Style Transfer specifically transforms existing content while preserving the original composition. This tool helps create consistent content across multiple assets.
How to use
Please invoke this endpoint with a POST request.
The headers of the request must include an API key in the authorization field. The body of the request must be
multipart/form-data, and the accept header should be set to one of the following:
image/*to receive the image in the format specified by theoutput_formatparameter.application/jsonto receive the image encoded as base64 in a JSON response.
The body of the request should include:
init_imagestyle_image
The body may optionally include:
promptnegative_promptstyle_strengthcomposition_fidelitychange_strengthseedoutput_format
Note: for more details about these parameters please see the request schema below.
Output
The resolution of the generated image will be 1MP, with the same aspect ratio as the init_image.
Credits
Flat rate of 8 credits per successful generation. You will not be charged for failed generations.
Authorizations
Your Stability API key, sent as a bearer token in the Authorization header.
Headers
Body
An image containing the subject you wish to restyle.
Supported Formats:
- jpeg
- png
- webp
Validation Rules:
- Width must be between 64 and 16,383 pixels
- Height must be between 64 and 16,383 pixels
- Total pixel count must be between 4,096 and 9,437,184 pixels
- The aspect ratio must be between 1:2.5 and 2.5:1
What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results.
To control the weight of a given word use the format (word:weight),
where word is the word you'd like to control the weight of and weight
is a value between 0 and 1. For example: The sky was a crisp (blue:0.3) and (green:0.8)
would convey a sky that was blue and green, but more green than blue.
10000Sometimes referred to as denoising, this parameter controls how much influence the
style_image parameter has on the generated image. A value of 0 would yield an image that
is identical to the input. A value of 1 would be as if you passed in no image at all.
0 <= x <= 1Response
Generation was successful.
The bytes of the generated image.
The finish-reason and seed will be present as headers.