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.

~1.95s
~$0.001
 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

POSThttps://api.segmind.com/v1/text-overlay

Parameters

blend_moderequired
string

Blend mode for text overlay

Default: "normal"
Allowed values (29 total):
"normal""dissolve""darken""multiply""color burn""linear burn""darker color""lighten""screen""color dodge"+19 more
imagerequired
string (uri)

URL of the image

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/txt_overlay_in.png.jpeg"
textrequired
string

Text to be displayed on the image

Default: "TRAVEL\n TODAY"
alignoptional
string

Text alignment

Default: "right"
Allowed values :
"left""right""center"
base64optional
boolean

Output image as base64 format

Default: false
coloroptional
string

Text color

Default: "#FFF"
fontoptional
string

Font style for the text

Default: "JosefinSans-Bold"
Allowed values (37 total):
"AlexBrush-Regular""Allura-Regular""AmaticSC-Regular""Canterbury""JosefinSans-Bold""JosefinSans-BoldItalic""JosefinSans-Italic""JosefinSans-Light""JosefinSans-LightItalic""JosefinSans-Regular"+27 more
font_sizeoptional
integer

Font size for the text

Default: 150Range: 1 - 2500
graphspaceoptional
integer

Controls spacing between text and surrounding elements.

Default: 0Range: 0 - 2048
image_formatoptional
string

Output image format.

Default: "webp"
Allowed values :
"jpeg""png"
image_qualityoptional
integer

Quality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality

Default: 90Range: 0 - 100
linespaceoptional
integer

Space between lines

Default: 10Range: 0 - 2048
margin_xoptional
integer

Margin X for positioning text

Default: 97Range: 0 - 2048
margin_yoptional
integer

Margin Y for positioning text

Default: 300Range: 0 - 2048
outline_coloroptional
string

Outline color for text

Default: "#11ff00"
outline_sizeoptional
integer

Outline size for text

Default: 0Range: 0 - 2048
text_underlayoptional
boolean

Specifies whether the text should be rendered behind an object or remain in front of it

Default: true
wrapoptional
integer

Wrap width for text

Default: 50Range: 0 - 2048

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out