Aspose Imaging .NET Image merge Plugin Licensing

Overview

Aspose.Imaging for .NET Image merge Plugin allows users to combine few images into one.

Examples of such conversions are available here.

What platforms are supported for Image merge Plugin usage

NETStandard2.0 and higher .NET platforms are suitable for Image merge plugin licensing.

Is there any demo application to review Aspose.Imaging for .NET Image merge Plugin usage

Yes, you can try Aspose.Imaging Image merge Application

What will happen, If I will use API entries, that are not licensed by Image merge Plugin License

Aspose.Imaging will work in trial mode.

Can I use other Plugin licenses with Image merge Plugin License?

Yes, you can use as many as you need other available plugin licenses:

How can I buy and use Image merge plugin only?

Example of usage of Image merge Plugin

//---------------------------------------------------------------------------------------
// Image merge plug-in use examples
//---------------------------------------------------------------------------------------
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;
Run4();
void Run4()
{
// Valid image merge 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;
var images = new List<Image>();
int maxWidth = 0;
int maxHeight = 0;
int totalWidth = 0;
int totalHeight = 0;
string[] imagePaths = new string[] { "template.png", "template.jpg", "template.bmp" };
foreach (string fileName in imagePaths)
{
var image = Image.Load(Path.Combine(templatesFolder, fileName));
totalWidth += image.Width;
if (image.Width > maxWidth)
{
maxWidth = image.Width;
}
totalHeight += image.Height;
if (image.Height > maxHeight)
{
maxHeight = image.Height;
}
images.Add(image);
}
try
{
var outputPath = Path.Combine(OutputDirectory, "licensed_merge_horizontal.jpg");
MergeImages(images, MergeDirection.Horizontal, totalWidth, maxHeight, outputPath);
File.Delete(outputPath);
outputPath = Path.Combine(OutputDirectory, "licensed_merge_vertical.jpg");
MergeImages(images, MergeDirection.Vertical, totalHeight, maxWidth, outputPath);
File.Delete(outputPath);
// Unlicensed crop with merge plug-in license
outputPath = Path.Combine(OutputDirectory, "trial_merge_vertical.jpg");
MergeImages(images, MergeDirection.Vertical, totalHeight, maxWidth, outputPath,
(image) =>
{
var rasterImage = image as RasterImage;
if (rasterImage == null)
{
return false;
}
rasterImage.Crop(new Rectangle(0, 0, image.Width >> 1, image.Height >> 1));
return true;
}
);
File.Delete(outputPath);
}
finally
{
images.ForEach(image => image.Dispose());
}
}
void MergeImages(List<Image> images, MergeDirection direction, int totalSize, int maxSize, string outputPath, Func<Image, bool> callback = null)
{
int targetWidth, targetHeight;
switch (direction)
{
case MergeDirection.Horizontal:
{
targetWidth = totalSize;
targetHeight = maxSize;
break;
}
case MergeDirection.Vertical:
{
targetWidth = maxSize;
targetHeight = totalSize;
break;
}
default:
throw new ArgumentException("Unexpected merge direction");
}
var pngOptions = new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha };
using (Stream stream = new MemoryStream())
{
pngOptions.Source = new StreamSource(stream);
using (var image = Image.Create(pngOptions, targetWidth, targetHeight))
{
image.BackgroundColor = Color.White;
var graphics = new Graphics(image);
float x = 0, y = 0;
images.ForEach(image =>
{
graphics.DrawImage(image, new RectangleF(x, y, image.Width, image.Height));
if (direction == MergeDirection.Horizontal)
{
x += image.Width;
}
if (direction == MergeDirection.Vertical)
{
y += image.Height;
}
});
if (callback != null)
{
callback(image);
}
image.Save(outputPath);
}
}
}
enum MergeDirection
{
Horizontal = 0,
Vertical = 1
}

Can other Aspose products be used in same way?

Yes, you can check https://aspose.market for available plugin licenses.