1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const axios = require('axios');
const fs = require('fs');
const path = require('path');
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/kling-heart-gesture";
const data = {
"first_reference_image": "toB64('https://segmind-resources.s3.amazonaws.com/output/d632119c-c0f7-4de8-8245-e1a28f80dd98-man2.png')",
"second_reference_image": "toB64('https://segmind-resources.s3.amazonaws.com/output/fc0debeb-5da3-4b98-8dbe-f3ef3747cd04-model_4.png')",
"mode": "pro",
"duration": 5
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();
First Reference Image
Second Reference Image
Mode of generation
Allowed values:
Duration of the animation in seconds
Allowed values:
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
The Kling-heart-gesture effect from Kling AI empowers users to effortlessly generate engaging videos that depict a heart-shaped gesture by combining two portrait images. This innovative feature is designed for individuals, content creators, and businesses seeking a simple yet impactful way to express affection, positivity, and connection in their visual content. The key differentiator lies in its ability to automatically stitch two static images and animate them into a heartwarming scene without requiring complex video editing skills, making it highly accessible and efficient for creating emotionally resonant videos.
Dual Portrait Input Capability - Users can easily upload two individual portrait photographs, which serve as the foundation for the animated heart gesture video. This allows for personalized and relatable content creation featuring specific individuals.
Automatic Image Stitching - The Kling AI system automatically and seamlessly merges the two uploaded portrait images into a single composite frame, preparing them for the animation process. This eliminates the need for manual alignment or merging of images.
Heart Gesture Animation - The core functionality of this effect is to generate a dynamic video animation showcasing a heart-shaped gesture involving the subjects of the two input portraits. This provides a visually engaging way to convey emotions like love, care, and appreciation.
Emotionally Expressive Output - The generated videos are specifically designed to communicate feelings of affection and positivity, making them ideal for personal greetings, social media content, and heartfelt messages.