# ai-group-photo
A lightweight Elixir library for programmatically generating AI-powered group photos from individual images. Simplifies image manipulation and composition for creating compelling visual content.
## Installation
Add `ai_group_photo` to your list of dependencies in `mix.exs`:
elixir
def deps do
[
{:ai_group_photo, "~> 0.1.0"} # Replace with the latest version
]
end
Then, run `mix deps.get` to fetch the dependency.
## Usage Examples
Here are a few examples of how to use `ai_group_photo` in your Elixir applications:
**1. Basic Group Photo Generation:**
elixir
alias AiGroupPhoto
image_paths = ["/path/to/image1.jpg", "/path/to/image2.png", "/path/to/image3.jpeg"]
case AiGroupPhoto.generate(image_paths) do
{:ok, output_path} ->
IO.puts("Group photo generated at: #{output_path}")
{:error, reason} ->
IO.puts("Error generating group photo: #{reason}")
end
**2. Configuring Output Dimensions:**
elixir
alias AiGroupPhoto
image_paths = ["/path/to/image1.jpg", "/path/to/image2.png"]
options = %{width: 800, height: 600}
case AiGroupPhoto.generate(image_paths, options) do
{:ok, output_path} ->
IO.puts("Group photo generated at: #{output_path}")
{:error, reason} ->
IO.puts("Error generating group photo: #{reason}")
end
**3. Handling Errors with Pattern Matching:**
elixir
alias AiGroupPhoto
image_paths = ["/path/to/image1.jpg", "/path/to/nonexistent_image.png"]
AiGroupPhoto.generate(image_paths)
|> case do
{:ok, output_path} ->
IO.puts("Group photo generated at: #{output_path}")
{:error, :invalid_image_path} ->
IO.puts("One or more image paths are invalid.")
{:error, reason} ->
IO.puts("An unexpected error occurred: #{reason}")
end
**4. Using Pipes for Fluent Image Processing:**
elixir
alias AiGroupPhoto
image_paths = ["/path/to/image1.jpg", "/path/to/image2.png"]
image_paths
|> AiGroupPhoto.generate(%{width: 1024, height: 768, output_format: :png})
|> case do
{:ok, output_path} ->
IO.puts("Group photo generated at: #{output_path}")
{:error, reason} ->
IO.puts("Error: #{reason}")
end
**5. Customizing the background color:**
elixir
alias AiGroupPhoto
image_paths = ["/path/to/image1.jpg", "/path/to/image2.png"]
options = %{background_color: "white"}
case AiGroupPhoto.generate(image_paths, options) do
{:ok, output_path} ->
IO.puts("Group photo generated at: #{output_path}")
{:error, reason} ->
IO.puts("Error generating group photo: #{reason}")
end
## Feature Summary
* **Automated Group Photo Creation:** Generate group photos from a list of individual image paths.
* **Flexible Configuration:** Customize output dimensions (width, height), and background color.
* **Error Handling:** Robust error reporting for invalid image paths and other issues.
* **Easy Integration:** Seamlessly integrate into your Elixir applications.
* **Support for various image formats:** Handles JPEG, PNG, and other common image formats.
## License
MIT
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/