本文整理汇总了C#中ImageMagick.MagickImageCollection.AppendVertically方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImageCollection.AppendVertically方法的具体用法?C# MagickImageCollection.AppendVertically怎么用?C# MagickImageCollection.AppendVertically使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImageCollection
的用法示例。
在下文中一共展示了MagickImageCollection.AppendVertically方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CombineScreenshot
/// <summary>
/// Combines the screenshots into one contiguous screenshot
/// </summary>
/// <param name="files">The files (images) to combine</param>
/// <param name="e">For UX, an output progress message</param>
public static void CombineScreenshot(FileSystemInfo[] files, WaitWindowEventArgs e)
{
string screenshotLocation = Path.Combine(Constants.CacheLocation, "temp.png");
using (MagickImageCollection images = new MagickImageCollection())
{
// Add the first image
var orderedFiles = files.OrderBy(f => f.CreationTime);
foreach (FileSystemInfo file in orderedFiles)
{
MagickImage first = new MagickImage(file.FullName);
e.Window.Message = "Obtaining Snapshots... Please Wait";
images.Add(first);
}
using (MagickImage result = images.AppendVertically())
{
e.Window.Message = "Building Screenshot... Please Wait" + System.Environment.NewLine + "This can take a minute.";
try
{
result.Write(screenshotLocation);
} catch (MagickImageErrorException err)
{
Debug.WriteLine($"Error: {err}");
}
}
}
}
示例2: ConvertPDFTOneImage
public static void ConvertPDFTOneImage()
{
MagickReadSettings settings = new MagickReadSettings();
// Settings the density to 300 dpi will create an image with a better quality
settings.Density = new PointD(300, 300);
using (MagickImageCollection images = new MagickImageCollection())
{
// Add all the pages of the pdf file to the collection
images.Read(SampleFiles.SnakewarePdf, settings);
// Create new image that appends all the pages horizontally
using (MagickImage horizontal = images.AppendHorizontally())
{
// Save result as a png
horizontal.Write(SampleFiles.OutputDirectory + "Snakeware.horizontal.png");
}
// Create new image that appends all the pages horizontally
using (MagickImage vertical = images.AppendVertically())
{
// Save result as a png
vertical.Write(SampleFiles.OutputDirectory + "Snakeware.vertical.png");
}
}
}
示例3: Test_Append
public void Test_Append()
{
int width = 70;
int height = 46;
using (MagickImageCollection collection = new MagickImageCollection(Files.RoseSparkleGIF))
{
Assert.AreEqual(width, collection[0].Width);
Assert.AreEqual(height, collection[0].Height);
using (MagickImage image = collection.AppendHorizontally())
{
Assert.AreEqual(width * 3, image.Width);
Assert.AreEqual(height, image.Height);
}
using (MagickImage image = collection.AppendVertically())
{
Assert.AreEqual(width, image.Width);
Assert.AreEqual(height * 3, image.Height);
}
}
}
示例4: Test_Append
public void Test_Append()
{
int width = 70;
int height = 46;
using (MagickImageCollection collection = new MagickImageCollection())
{
ExceptionAssert.Throws<InvalidOperationException>(delegate ()
{
collection.AppendHorizontally();
});
ExceptionAssert.Throws<InvalidOperationException>(delegate ()
{
collection.AppendVertically();
});
collection.Read(Files.RoseSparkleGIF);
Assert.AreEqual(width, collection[0].Width);
Assert.AreEqual(height, collection[0].Height);
using (MagickImage image = collection.AppendHorizontally())
{
Assert.AreEqual(width * 3, image.Width);
Assert.AreEqual(height, image.Height);
}
using (MagickImage image = collection.AppendVertically())
{
Assert.AreEqual(width, image.Width);
Assert.AreEqual(height * 3, image.Height);
}
}
}
示例5: ExecuteAppendVertically
private static MagickImage ExecuteAppendVertically(MagickImageCollection collection)
{
return collection.AppendVertically();
}
示例6: Test_FlipFlop
public void Test_FlipFlop()
{
using (MagickImageCollection collection = new MagickImageCollection())
{
collection.Add(new MagickImage(MagickColors.DodgerBlue, 10, 10));
collection.Add(new MagickImage(MagickColors.Firebrick, 10, 10));
using (MagickImage image = collection.AppendVertically())
{
ColorAssert.AreEqual(MagickColors.DodgerBlue, image, 5, 0);
ColorAssert.AreEqual(MagickColors.Firebrick, image, 5, 10);
image.Flip();
ColorAssert.AreEqual(MagickColors.Firebrick, image, 5, 0);
ColorAssert.AreEqual(MagickColors.DodgerBlue, image, 5, 10);
}
using (MagickImage image = collection.AppendHorizontally())
{
ColorAssert.AreEqual(MagickColors.DodgerBlue, image, 0, 5);
ColorAssert.AreEqual(MagickColors.Firebrick, image, 10, 5);
image.Flop();
ColorAssert.AreEqual(MagickColors.Firebrick, image, 0, 5);
ColorAssert.AreEqual(MagickColors.DodgerBlue, image, 10, 5);
}
}
}