Mở rộng hình ảnh với Kling
Sử dụng Kling Image Expansion API qua CometAPI để mở rộng hình ảnh vượt ra ngoài viền gốc với khả năng outpainting có thể kiểm soát.
Cách các tỷ lệ mở rộng hoạt động
- Mỗi tỷ lệ được đo dựa trên chiều rộng hoặc chiều cao gốc
- Vùng canvas mở rộng kết hợp vẫn phải nằm trong giới hạn diện tích được Kling ghi rõ trong tài liệu
- Hãy bắt đầu với các giá trị nhỏ như
0.1cho mỗi cạnh trước khi thử các mức mở rộng lớn hơn
Luồng request
- Gửi cả bốn trường tỷ lệ, dùng
0cho bất kỳ cạnh nào bạn không muốn mở rộng - Lưu
task_idđược trả về - Poll đường dẫn truy vấn hình ảnh Kling tương ứng cho đến khi task đạt trạng thái kết thúc
Ủy quyền
Bearer token authentication. Use your CometAPI key.
Tiêu đề
Must be application/json.
Nội dung
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.