Pruna P Image Edit Serverless API
Pruna's p-image-edit enables sophisticated multi-image editing with AI-guided precision and style applications.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/p-image-edit"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Make the character from image 1 lean against the logo from image 2, as if the logo is standing upright on the ground",
12 "image_urls": [
13 "https://segmind-resources.s3.amazonaws.com/input/116b8cb5-bfc4-4589-b824-0065631919c8-pruna-logo.jpg",
14 "https://segmind-resources.s3.amazonaws.com/input/07ccec90-0c1b-4016-b15c-c09c140218c8-segmind-logo.png"
15 ],
16 "aspect_ratio": "match_input_image",
17 "seed": 42,
18 "disable_safety_checker": false
19}
20
21response = requests.post(url, headers=headers, json=data)
22
23if response.status_code == 200:
24 result = response.json()
25 print(json.dumps(result, indent=2))
26else:
27 print(f"Error: {response.status_code}")
28 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/p-image-edit"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Make the character from image 1 lean against the logo from image 2, as if the logo is standing upright on the ground",
12 "image_urls": [
13 "https://segmind-resources.s3.amazonaws.com/input/116b8cb5-bfc4-4589-b824-0065631919c8-pruna-logo.jpg",
14 "https://segmind-resources.s3.amazonaws.com/input/07ccec90-0c1b-4016-b15c-c09c140218c8-segmind-logo.png"
15 ],
16 "aspect_ratio": "match_input_image",
17 "seed": 42,
18 "disable_safety_checker": false
19}
20
21response = requests.post(url, headers=headers, json=data)
22
23if response.status_code == 200:
24 result = response.json()
25 print(json.dumps(result, indent=2))
26else:
27 print(f"Error: {response.status_code}")
28 print(response.text)API Endpoint
https://api.segmind.com/v1/p-image-editParameters
image_urlsrequiredstring[]Provide a list of image URLs for editing. Ensure URLs are accessible online.
promptrequiredstringDescribes the desired image edit or composition. Use vivid adjectives for creativity.
aspect_ratiooptionalstringDetermines the output image's shape. Use '1:1' for square or '16:9' for widescreen.
"match_input_image""match_input_image""1:1""16:9""9:16""4:3""3:4""3:2""2:3"disable_safety_checkeroptionalbooleanToggles safety features for image generation. Disable if you're working with creative edits.
falseseedoptionalintegerSets seed for consistent output. Use -1 for a unique, random generation each time.
42Range: -1 - 999999999999999Response Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out