Imagise.Merger 24.9.2

dotnet add package Imagise.Merger --version 24.9.2                
NuGet\Install-Package Imagise.Merger -Version 24.9.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Imagise.Merger" Version="24.9.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Imagise.Merger --version 24.9.2                
#r "nuget: Imagise.Merger, 24.9.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Imagise.Merger as a Cake Addin
#addin nuget:?package=Imagise.Merger&version=24.9.2

// Install Imagise.Merger as a Cake Tool
#tool nuget:?package=Imagise.Merger&version=24.9.2                

Imagise.Merger plugin for .NET

** The Imagise Image Merger plugin for .NET enables seamless merging of images either vertically or horizontally without compromising quality, encouraging creativity in designing unique photo collages. This flexible tool supports multiple file formats, allowing you to easily craft visually striking compositions.**

Platform Independence

Imagise.Merger plugin for .NET can be used to develop applications on Windows Desktop (x86, x64), Windows Server (x86, x64), Windows Azure, Windows Embedded (CE 6.0 R2), as well as Linux x64. The supported platforms include .Net6.0, .Net7.0, .Net8.0.

New Features & Enhancements in Version 24.9

Imagise.Merger is live.

Getting Started with Imagise.Merger plugin for .NET

Ready to try the Imagise.Merger plugin for .NET? You can easily add the Imagise.Merger NuGet package to your .NET application by running the following command in the Package Manager Console in Visual Studio:

Install-Package Imagise.Merger

If you already have Imagise.Merger installed and want to upgrade to the latest version, simply run:

Update-Package Imagise.Merger

This will ensure you have the most up-to-date version.

The following examples can assist you in applying merge within your application

Merge images vertically or horizonatlly

var images = new List<Image>();

int maxWidth = 0;
int maxHeight = 0;
int totalWidth = 0;
int totalHeight = 0;

foreach (var fileName in Directory.GetFiles(inputFolder))
{
     var image = Image.Load(Path.Combine(inputFolder, 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(outputFolder, "merge_horizontal.jpg");
     MergeImages(images, MergeDirection.Horizontal, totalWidth, maxHeight, outputPath);

     outputPath = Path.Combine(outputFolder, "merge_vertical.jpg");
     MergeImages(images, MergeDirection.Vertical, totalHeight, maxWidth, outputPath);
}
finally
{
     images.ForEach(image => image.Dispose());
}

static void MergeImages(List<Image> images, MergeDirection direction, int totalSize, int maxSize, string outputPath)
{
     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 = Imagise.Core.Creator.Image.Create(pngOptions, targetWidth, targetHeight))
          {
             var graphics = new Graphics(image);
             graphics.Clear(Color.White);

             float x = 0, y = 0;
             images.ForEach(image =>
             {
                 if (image.IsVectorImage)
                 {
                    graphics.PaintableImageOptions = new BmpOptions()
                    {
                        BitsPerPixel = 32,
                        VectorRasterizationOptions = ImagiseHelper.CreateVectorRasterizationOptions(image.FileFormat,
                                                          new Size(image.Width, image.Height))
                    };
                 }

                 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;
                 }
             });

             image.Save(outputPath);
          }
     }
}

enum MergeDirection
{
     Horizontal = 0,
     Vertical = 1
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
24.9.2 6 9/8/2024
24.9.1 5 9/6/2024
24.9.0 1 9/6/2024
24.8.5 5 8/8/2024