Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,486 Commits
1,486 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verify.ImageMagick

Discussions Build status NuGet Status

Extends Verify to allow verification of documents via Magick.NET.

See Milestones for release notes.

Converts documents pdfs to png for verification.

Contains comparers for png, jpg, bmp, and tiff.

Sponsors

Entity Framework Extensions

Entity Framework Extensions is a major sponsor and is proud to contribute to the development this project.

Entity Framework Extensions

Developed using JetBrains IDEs

JetBrains logo.

NuGet

Usage

[ModuleInitializer]
public static void Init()
{
    VerifyImageMagick.Initialize();
    VerifyImageMagick.RegisterComparers(threshold: 0.5);
}

snippet source | anchor

Initialize registers the pdf to png converter and all comparers.

PDF converter

To register only the pdf to png converter:

VerifyImageMagick.RegisterPdfToPngConverter();

Verify a file

[Test]
public Task VerifyPdf() =>
    VerifyFile("sample.pdf");

snippet source | anchor

Verify a Stream

[Test]
public Task VerifyPdfStream()
{
    var stream = new MemoryStream(File.ReadAllBytes("sample.pdf"));
    return Verify(stream, "pdf");
}

snippet source | anchor

Result

Samples.VerifyPdf#00.verified.png:

Image Comparers

The following will use ImageMagick to compare the images instead of the default binary comparison.

[Test]
public Task CompareImage() =>
    VerifyFile("sample.jpg");

snippet source | anchor

Register all comparers

All comparers can be registered:

VerifyImageMagick.RegisterComparers();

Override transparent background

For images with a transparent background, that background can be overridden:

[Test]
public Task BackgroundColor() =>
    VerifyFile("transparent.png")
        .ImageMagickBackground(MagickColors.Blue);

snippet source | anchor

Open password-protected PDFs

For password-protected PDF, the password can be provided to allow verification:

[Test]
public Task PdfPassword() =>
    VerifyFile("password.pdf")
        .ImageMagickPdfPassword("password");

snippet source | anchor

Icon

Swirl designed by Philipp Petzka from The Noun Project.

About

Extends Verify to allow verification of documents via ImageMagick.NET.

Resources

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.