///<summary> /// Create a composite image by combining the images with the specified settings. ///</summary> ///<param name="settings">The settings to use.</param> ///<exception cref="MagickException"/> public MagickImage Montage(MontageSettings settings) { ThrowIfEmpty(); Throw.IfNull("settings", settings); IntPtr images; try { AttachImages(); if (!string.IsNullOrEmpty(settings.Label)) { _Images[0].Label = settings.Label; } images = _NativeInstance.Montage(_Images[0], settings); } finally { DetachImages(); } using (MagickImageCollection collection = new MagickImageCollection()) { collection.AddRange(MagickImage.CreateList(images, _Images[0].Settings)); if (settings.TransparentColor != null) { foreach (MagickImage image in collection) { image.Transparent(settings.TransparentColor); } } return(collection.Merge()); } }
public void Test_Merge() { using (MagickImageCollection collection = new MagickImageCollection()) { ExceptionAssert.Throws<InvalidOperationException>(delegate () { collection.Merge(); }); collection.Read(Files.RoseSparkleGIF); using (MagickImage first = collection.Merge()) { Assert.AreEqual(collection[0].Width, first.Width); Assert.AreEqual(collection[0].Height, first.Height); } } }
public void Test_Combine() { using (MagickImage rose = new MagickImage(Files.Builtin.Rose)) { using (MagickImageCollection collection = new MagickImageCollection()) { ExceptionAssert.Throws<InvalidOperationException>(delegate () { collection.Combine(); }); collection.AddRange(rose.Separate(Channels.RGB)); Assert.AreEqual(3, collection.Count); MagickImage image = collection.Merge(); Assert.AreNotEqual(rose.TotalColors, image.TotalColors); image.Dispose(); image = collection.Combine(); Assert.AreEqual(rose.TotalColors, image.TotalColors); } } }
public void Test_Merge() { using (MagickImageCollection collection = new MagickImageCollection(Files.RoseSparkleGIF)) { using (MagickImage first = collection.Merge()) { Assert.AreEqual(collection[0].Width, first.Width); Assert.AreEqual(collection[0].Height, first.Height); } } }
public void Test_Combine() { using (MagickImage rose = new MagickImage(Files.Builtin.Rose)) { using (MagickImageCollection collection = new MagickImageCollection(rose.Separate(Channels.RGB))) { Assert.AreEqual(3, collection.Count); MagickImage image = collection.Merge(); Assert.AreNotEqual(rose.TotalColors, image.TotalColors); image.Dispose(); image = collection.Combine(); Assert.AreEqual(rose.TotalColors, image.TotalColors); } } }
private static MagickImage ExecuteMerge(MagickImageCollection collection) { return collection.Merge(); }
private static MagickImage ExecuteMerge(MagickImageCollection collection) { return(collection.Merge()); }