Photo Album Maker Licensing Plugin

Contents
[ ]

         The Photo Album Maker Licensing Plugin offers a convenient way to combine your images or photos into handy multi-page albums. You can utilize a variety of image files in different formats from the list of supported image formats to seamlessly merge them and create a single multi-page file such as a PDF or TIFF format. Before creating a photo album, ensure you acquire a Metered license by providing your public key and private password using the `SetMeteredKey()` method. In the C# code example below, we create a new `TiffImage` object and add existing images using the AddFrame() method. If you prefer to create a PDF file containing your original images on separate pages, you can easily utilize the Image.Create() constructor with an array of images passed as a parameter and save the output to the file with `PdfOptions`. Please be aware that utilizing unlicensed features of the Aspose.Imaging graphic library will result in a watermark appearing on the output image.

using Aspose.Imaging;
using Aspose.Imaging.FileFormats.Emf;
using Aspose.Imaging.FileFormats.Png;
using Aspose.Imaging.FileFormats.Tiff;
using Aspose.Imaging.FileFormats.Tiff.Enums;
using Aspose.Imaging.ImageOptions;
using Aspose.Imaging.Sources;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
string dataDir = templatesFolder;
Run5();
//------------------------------------------------------------------
// Image album create plug-in example
//------------------------------------------------------------------
void Run5()
{
// Valid image album plug-in license use example
Metered license = new Metered();
// Only metered plug-in license is supported
license.SetMeteredKey("<your public key>", "<your private key>");
string OutputDirectory = templatesFolder;
if (!Directory.Exists(OutputDirectory))
{
Directory.CreateDirectory(OutputDirectory);
}
var images = new List<Image>();
string[] imagePaths = new string[] { "template.png", "template.jpg", "template.bmp" };
foreach (var fileName in imagePaths)
{
var image = Image.Load(Path.Combine(templatesFolder,fileName));
images.Add(image);
}
try
{
var outputPath = Path.Combine(templatesFolder, "licensed_image_album.pdf");
MakeAlbum(images, new PdfOptions(), outputPath);
File.Delete(outputPath);
// Unlicensed use
outputPath = Path.Combine(templatesFolder, "trial_image_album.tiff");
MakeTiffAlbum(images, new TiffOptions(TiffExpectedFormat.TiffDeflateRgba), outputPath);
File.Delete(outputPath);
}
finally
{
images.ForEach(image => image.Dispose());
}
}
void MakeTiffAlbum(List<Image> images, TiffOptions rgbOptions, string outputPath)
{
using var tiffImage = new TiffImage(Array.Empty<TiffFrame>());
foreach (var image in images.Where(image => image is RasterImage))
{
tiffImage.AddFrame(new TiffFrame(image as RasterImage, rgbOptions));
tiffImage.Frames[tiffImage.Frames.Length - 1].Grayscale();
}
tiffImage.ActiveFrame = tiffImage.Frames[0];
tiffImage.Save(outputPath, rgbOptions);
}
void MakeAlbum(List<Image> images, ImageOptionsBase imageOptions, string outputPath)
{
using (var image = Image.Create(images.ToArray()))
{
image.Save(outputPath, imageOptions);
}
}
enum MergeDirection
{
Horizontal = 0,
Vertical = 1
}

Explore the functionalities of our free online Aspose.Imaging Photo Book Maker App website.