API
If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
# Use this function to convert a list of image URLs to base64
def image_urls_to_base64(image_urls):
return [image_url_to_base64(url) for url in image_urls]
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/runway-gen4-image"
# Request payload
data = {
"promptText": "photo of a model wearing a cloth and standing in a garden.",
"referenceImages": [
{
"uri": "https://segmind-inference-inputs.s3.amazonaws.com/c226e2cf-49ea-4b8d-a630-9847c0efbbce-Beach-walk.png",
"tag": "model"
},
{
"uri": "https://segmind-resources.s3.amazonaws.com/output/cfda480d-86f3-4230-aed3-fcfae874df3b-saree.webp",
"tag": "cloth"
}
],
"ratio": "1280:720"
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
Describes the desired animation. Use 'rainforest waterfall' for nature or 'cyberpunk alley' for futurism.
A list of images.
Sets output aspect ratio. Choose 1280:720 for YouTube or 1920:1080 for HD movies.
Allowed values:
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Leveraging Runway's Gen-4 Image API for Creative and Technical Excellence
Runway's Gen-4 Image API, featuring the Gen-4 References model, is a significant innovation in AI-driven image generation that empowers both developers and creators. By integrating this versatile platform into various workflows, users can harness advanced multimodal generation to achieve a broad spectrum of applications, including virtual try-on, gaming asset creation, interior design visualization, and custom creative tools.
Key Features and Implementation
Multimodal Generation
Developers and creators can blend visual references with text prompts to generate tailored images that precisely align with creative goals. This multimodal capability allows for detailed customization, making it a powerful tool in diverse fields.
Flexibility with Bounding Boxes
For precision, developers can deploy bounding boxes within the API to pinpoint and manipulate specific elements. This feature ensures accurate composition and style adherence, crucial for developers focusing on fine details.
Seamless Integration
The API's design supports seamless integration with existing creative tools, enhancing workflow efficiency and productivity. By embedding the API into existing platforms, users can streamline processes and amplify creative output.
Practical Applications
- Virtual Try-On: Enhance retail websites with interactive, personalized shopping experiences.
- Gaming Asset Creation: Revolutionize game development by dynamically generating assets, thus saving time and resources.
- Interior Design Visualization: Quickly prototype design ideas, reducing reliance on physical mock-ups.
- Custom Creative Tools: Build intuitive, interactive design solutions with pinpoint scene manipulation.
Effective Utilization Tips
Craft precise text prompts and utilize high-quality reference images to guide the image generation process. Embrace the API's flexibility by integrating it with other tools, which maximizes both creativity and practical application in various domains.
In summary, Runway's Gen-4 Image API is an invaluable asset for those seeking to leverage generative AI's potential. Whether developing detailed gaming environments or providing unique virtual retail solutions, this API supports creative and technical innovation at a competitive cost, making advanced image generation accessible and transformative.
Other Popular Models
idm-vton
Best-in-class clothing virtual try on in the wild

face-to-many
Turn a face into 3D, emoji, pixel art, video game, claymation or toy

faceswap-v2
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training

codeformer
CodeFormer is a robust face restoration algorithm for old photos or AI-generated faces.
