Étendre une image avec Kling
Utilisez l’API Kling Image Expansion via CometAPI pour étendre des images au-delà de leurs bordures d’origine avec un outpainting contrôlable.
Fonctionnement des ratios d’extension
- Chaque ratio est mesuré par rapport à la largeur ou à la hauteur d’origine
- La zone de canevas étendue combinée doit toujours rester dans les limites de surface documentées par Kling
- Commencez avec de petites valeurs comme
0.1de chaque côté avant de tenter des extensions plus importantes
Flux de requête
- Envoyez les quatre champs de ratio, en utilisant
0pour tout côté que vous ne souhaitez pas étendre - Enregistrez le
task_idrenvoyé - Interrogez le chemin de requête d’image Kling correspondant jusqu’à ce que la tâche atteigne un état terminal
Autorisations
Bearer token authentication. Use your CometAPI key.
En-têtes
Must be application/json.
Corps
Source image to expand. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.
Upward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.
0 <= x <= 2Downward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.
0 <= x <= 2Leftward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.
0 <= x <= 2Rightward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.
0 <= x <= 2Optional text prompt to guide the expanded area content. Maximum 2500 characters.
Number of expanded images to generate. Range: 1-9.
1 <= x <= 9Watermark options.
Webhook URL for task status notifications.
Optional user-defined task ID for your own tracking. Must be unique per account.