question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to adapt the console application code for Magik.Net C# Compare 2 pictures

See original GitHub issue

Good day, please help me translate the console code into Magik.Net C #

-metric AE -fuzz 15% -highlight-color red -lowlight-color white 1.png 2.png 123.png

I found this console code on the Internet, with a set of commands, like it is, but it needs to be in C# Actually, I have 2 pictures, I need to find the difference, and display the result in the third picture.

Need code for Windows 7 x64 I really hope for your help, I really look forward to hearing.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
dlemstracommented, Dec 1, 2019

I have not tested this but your command line example should translate to this:

using (var image1 = new MagickImage("1.png"))
{
    using (var image2 = new MagickImage("2.png"))
    {
        using (var image123 = new MagickImage())
        {
            var compareSettings = new CompareSettings()
            {
                HighlightColor = MagickColors.Red,
                LowlightColor = MagickColors.White,
                Metric = ErrorMetric.Absolute,
            };

            image1.ColorFuzz = new Percentage(15);
            image1.Compare(image2, compareSettings, image123);

            image123.Write("123.png");
        }
    }
}
1reaction
dlemstracommented, Dec 3, 2019

You are getting those bright pixels because you are saving the file as a .jpeg file. If you save it as a .png instead it only contains two colors.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Comparing two images using ImageMagick and C# - ...
This code for example show value from 0-1 that represent how similar the pictures are: MagickImage img1 = new MagickImage(@"C:\test\Image1. jpg ...
Read more >
Compare Image Data for Similarities - Console C# ...
This tutorial shows how to use various image processing commands to compare two images to determine how similar they are in a C#...
Read more >
Is it possible to compare 2 images and see the diff?
This code on ImageMagick, I would like to do the same on Magick.NET. Code: Select all convert anot.jpg one_real.jpg -compose difference ...
Read more >
.NET Core Image Processing - .NET Blog
NET Core to process images. For each option, I'll give a code sample for image resizing, and I'll outline interesting features. I'll conclude ......
Read more >
Simple image comparison in .NET
Find out how different two images are as a percentage value based on a threshold of your choosing; Get a difference-image which shows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found