ai-group-photo

A Dart package designed to simplify the generation of AI-powered group photos. This library provides tools for creating realistic and engaging group images from individual portraits.

Installation

To use ai-group-photo in your Dart project, add it as a dependency in your pubspec.yaml file: yaml dependencies: ai_group_photo: ^1.0.0 # Replace with the latest version

Then, run dart pub get to install the package.

Usage

Here are some examples of how you can use ai-group-photo in your Dart code:

1. Basic Group Photo Generation: dart import 'package:ai_group_photo/ai_group_photo.dart';

void main() async { final imageGenerator = GroupPhotoGenerator();

// Provide a list of image paths (local or network URLs) final imagePaths = 'path/to/image1.jpg', 'path/to/image2.png', 'https://example.com/image3.jpeg', 'path/to/image4.gif', ;

try { final generatedImage = await imageGenerator.generateGroupPhoto(imagePaths);

// Save the generated image to a file or display it.
// (Implementation details depend on your specific needs)
print('Group photo generated successfully!');

} catch (e) { print('Error generating group photo: $e'); } }

2. Customizing the Group Photo Layout: dart import 'package:ai_group_photo/ai_group_photo.dart';

void main() async { final imageGenerator = GroupPhotoGenerator( layoutOptions: LayoutOptions( arrangement: Arrangement.circle, // Arrange faces in a circle spacing: 10, // Add spacing between faces ), );

final imagePaths = 'path/to/image1.jpg', 'path/to/image2.png', ;

try { final generatedImage = await imageGenerator.generateGroupPhoto(imagePaths); // Save or display the image. } catch (e) { print('Error: $e'); } }

3. Handling Different Image Sizes: dart import 'package:ai_group_photo/ai_group_photo.dart';

void main() async { final imageGenerator = GroupPhotoGenerator( processingOptions: ProcessingOptions( resizeMode: ResizeMode.fit, // Fit images to a standard size targetSize: Size(200, 200), // Resize to 200x200 pixels ), );

final imagePaths = 'path/to/image1.jpg', 'path/to/image2.png', ;

try { final generatedImage = await imageGenerator.generateGroupPhoto(imagePaths); // Save or display the image. } catch (e) { print('Error: $e'); } }

4. Using a Custom Background: dart import 'package:ai_group_photo/ai_group_photo.dart';

void main() async { final imageGenerator = GroupPhotoGenerator( backgroundOptions: BackgroundOptions( backgroundPath: 'path/to/background.jpg', // Path to the background image ), );

final imagePaths = 'path/to/image1.jpg', 'path/to/image2.png', ;

try { final generatedImage = await imageGenerator.generateGroupPhoto(imagePaths); // Save or display the image. } catch (e) { print('Error: $e'); } }

Features

  • Intelligent Face Detection: Automatically detects faces in input images.
  • Flexible Layout Options: Supports various arrangements, including circle, grid, and custom layouts.
  • Image Processing: Handles different image sizes and formats.
  • Customizable Backgrounds: Allows setting a custom background image.
  • Error Handling: Provides informative error messages for debugging.
  • Asynchronous Operations: Uses async/await for efficient image processing.

License

MIT License

This package is part of the ai-group-photo ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/image/ai-group-photo/

Libraries

ai_group_photo