Text Overlay
Elevate your visuals withText Overlay Model. Easily add customized text to any image, perfect for social media, marketing, and blogs. Enjoy precise positioning, advanced styling, and seamless integration.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/text-overlay"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "align": "right",
12 "base64": false,
13 "blend_mode": "normal",
14 "color": "#FFF",
15 "font": "JosefinSans-Bold",
16 "font_size": 150,
17 "graphspace": 0,
18 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/txt_overlay_in.png.jpeg",
19 "image_format": "jpeg",
20 "image_quality": 90,
21 "linespace": 10,
22 "margin_x": 97,
23 "margin_y": 300,
24 "outline_color": "#11ff00",
25 "outline_size": 0,
26 "text": "TRAVEL\n TODAY",
27 "text_underlay": true,
28 "wrap": 50
29}
30
31response = requests.post(url, headers=headers, json=data)
32
33if response.status_code == 200:
34 result = response.json()
35 print(json.dumps(result, indent=2))
36else:
37 print(f"Error: {response.status_code}")
38 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/text-overlay"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "align": "right",
12 "base64": false,
13 "blend_mode": "normal",
14 "color": "#FFF",
15 "font": "JosefinSans-Bold",
16 "font_size": 150,
17 "graphspace": 0,
18 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/txt_overlay_in.png.jpeg",
19 "image_format": "jpeg",
20 "image_quality": 90,
21 "linespace": 10,
22 "margin_x": 97,
23 "margin_y": 300,
24 "outline_color": "#11ff00",
25 "outline_size": 0,
26 "text": "TRAVEL\n TODAY",
27 "text_underlay": true,
28 "wrap": 50
29}
30
31response = requests.post(url, headers=headers, json=data)
32
33if response.status_code == 200:
34 result = response.json()
35 print(json.dumps(result, indent=2))
36else:
37 print(f"Error: {response.status_code}")
38 print(response.text)API Endpoint
https://api.segmind.com/v1/text-overlayParameters
blend_moderequiredstringBlend mode for text overlay
"normal""normal""dissolve""darken""multiply""color burn""linear burn""darker color""lighten""screen""color dodge"+19 moreimagerequiredstring (uri)URL of the image
"https://segmind-sd-models.s3.amazonaws.com/display_images/txt_overlay_in.png.jpeg"textrequiredstringText to be displayed on the image
"TRAVEL\n TODAY"alignoptionalstringText alignment
"right""left""right""center"base64optionalbooleanOutput image as base64 format
falsecoloroptionalstringText color
"#FFF"fontoptionalstringFont style for the text
"JosefinSans-Bold""AlexBrush-Regular""Allura-Regular""AmaticSC-Regular""Canterbury""JosefinSans-Bold""JosefinSans-BoldItalic""JosefinSans-Italic""JosefinSans-Light""JosefinSans-LightItalic""JosefinSans-Regular"+27 morefont_sizeoptionalintegerFont size for the text
150Range: 1 - 2500graphspaceoptionalintegerControls spacing between text and surrounding elements.
0Range: 0 - 2048image_formatoptionalstringOutput image format.
"webp""jpeg""png"image_qualityoptionalintegerQuality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality
90Range: 0 - 100linespaceoptionalintegerSpace between lines
10Range: 0 - 2048margin_xoptionalintegerMargin X for positioning text
97Range: 0 - 2048margin_yoptionalintegerMargin Y for positioning text
300Range: 0 - 2048outline_coloroptionalstringOutline color for text
"#11ff00"outline_sizeoptionalintegerOutline size for text
0Range: 0 - 2048text_underlayoptionalbooleanSpecifies whether the text should be rendered behind an object or remain in front of it
truewrapoptionalintegerWrap width for text
50Range: 0 - 2048Response 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