Monday, January 30, 2023
HomeSoftware DevelopmentFind out how to Create a Diff of Two Pictures

Find out how to Create a Diff of Two Pictures


After I was a toddler, I liked on the lookout for Waldo within the “The place’s Waldo?” guide sequence. As of late I am a sucker for TMZ’s “What is the Large Frigin Distinction” pictures, the place TMZ barely adjustments a picture and you need to spot the variations between the 2. That obtained me to considering — how simply may I automate diff’ing two pictures? This StackOverflow submit was gold.

To create a diff of two comparable pictures, we’ll use ImageMagick’s convert command line utility with a big host of configurations:

convert '(' image1.png -flatten -grayscale Rec709Luminance ')' 
        '(' image2.png -flatten -grayscale Rec709Luminance ')' 
        '(' -clone 0-1 -compose darken -composite ')' 
        -channel RGB -combine diff.png

How efficient is that this command with its configuration arguments? Let’s take a look:

Unique Picture

Modified Picture

Diff’ed Picture

The diff picture result’s fairly informative! The scale of the sun shades is clearly introduced, and for those who look carefully, you may see one cranium on the top-right of the shirt has been flipped.

No matter your motive for eager to determine the distinction two pictures, ImageMagick’s convert software is spectacular. You may do 1,000,000 issues with ImageMagick; try my Media tutorials to be taught extra superior methods to switch pictures, movies, and audio!



Supply hyperlink
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments