ai-snow-trend
v1768557.14.476
Published
Professional integration for https://supermaker.ai/blog/how-to-make-ai-snow-trend-photos-for-tiktok-free-tutorial/
Readme
ai-snow-trend
A JavaScript utility for generating snow trend effects, inspired by popular social media trends, directly within your applications. This package simplifies the process of adding dynamic snow overlays and effects to images and videos.
Installation
bash npm install ai-snow-trend
Usage Examples
Below are several examples demonstrating how to use the ai-snow-trend package in various scenarios.
1. Basic Image Snow Overlay: javascript const aiSnowTrend = require('ai-snow-trend');
// Assuming you have an image file path const imagePath = './path/to/your/image.jpg';
aiSnowTrend.addSnowToImage(imagePath, { snowDensity: 0.7, // Adjust snow density (0.0 - 1.0) flakeColor: '#FFFFFF', // Snow flake color outputFile: './output/snow_image.jpg' // Output file path }) .then(() => { console.log('Snow effect added successfully!'); }) .catch(err => { console.error('Error adding snow effect:', err); });
2. Video Snow Overlay with Custom Settings: javascript const aiSnowTrend = require('ai-snow-trend');
// Assuming you have a video file path const videoPath = './path/to/your/video.mp4';
aiSnowTrend.addSnowToVideo(videoPath, { snowDensity: 0.5, flakeColor: '#EEEEEE', windSpeed: 2, // Adjust wind speed outputFile: './output/snow_video.mp4' }) .then(() => { console.log('Snow effect added to video successfully!'); }) .catch(err => { console.error('Error adding snow effect to video:', err); });
3. Using a Custom Snow Flake Image: javascript const aiSnowTrend = require('ai-snow-trend');
// Assuming you have an image file path and a custom flake image path const imagePath = './path/to/your/image.png'; const flakeImagePath = './path/to/your/snowflake.png';
aiSnowTrend.addSnowToImage(imagePath, { snowDensity: 0.6, flakeImage: flakeImagePath, outputFile: './output/custom_snow_image.png' }) .then(() => { console.log('Snow effect added with custom flakes!'); }) .catch(err => { console.error('Error adding snow effect:', err); });
4. Controlling Snowfall Direction (Image): javascript const aiSnowTrend = require('ai-snow-trend');
const imagePath = './path/to/your/image.jpeg';
aiSnowTrend.addSnowToImage(imagePath, { snowDensity: 0.8, windDirection: 'right', // Options: 'left', 'right', 'none' windSpeed: 1.5, outputFile: './output/snow_image_wind.jpeg' }) .then(() => { console.log('Snow effect added with wind!'); }) .catch(err => { console.error('Error adding snow effect:', err); });
5. Asynchronously Applying Snow to Multiple Images: javascript const aiSnowTrend = require('ai-snow-trend');
const imagePaths = [ './path/to/image1.jpg', './path/to/image2.png', './path/to/image3.jpeg' ];
async function processImages() {
for (const imagePath of imagePaths) {
try {
await aiSnowTrend.addSnowToImage(imagePath, {
snowDensity: 0.4,
outputFile: ./output/snow_${imagePath.split('/').pop()}
});
console.log(Snow effect added to ${imagePath});
} catch (err) {
console.error(Error adding snow to ${imagePath}:, err);
}
}
console.log('All images processed.');
}
processImages();
API Summary
addSnowToImage(imagePath, options): Adds a snow effect to an image. Returns a Promise.imagePath(string): Path to the input image file.options(object): An object containing configuration options:snowDensity(number, optional): Density of the snow (0.0 - 1.0). Default: 0.5.flakeColor(string, optional): Color of the snow flakes (e.g., '#FFFFFF'). Default: '#FFFFFF'.flakeImage(string, optional): Path to a custom snow flake image. If provided, overridesflakeColor.windSpeed(number, optional): Speed of the wind affecting the snow (0 - 5). Default: 0.windDirection(string, optional): Direction of the wind ('left', 'right', 'none'). Default: 'none'.outputFile(string): Path to the output image file.
addSnowToVideo(videoPath, options): Adds a snow effect to a video. Returns a Promise.videoPath(string): Path to the input video file.options(object): Same options asaddSnowToImage, plus video-specific configurations.
License
MIT
This package is part of the ai-snow-trend ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/blog/how-to-make-ai-snow-trend-photos-for-tiktok-free-tutorial/
