HomeSoftware DevelopmentThe best way to Create a Diff of Two Photos

The best way to Create a Diff of Two Photos


Once I was a toddler, I liked in search of Waldo within the “The place’s Waldo?” e-book sequence. Nowadays I am a sucker for TMZ’s “What is the Huge Frigin Distinction” pictures, the place TMZ barely modifications a picture and it’s important to spot the variations between the 2. That received me to considering — how simply might 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 offered, and in case you look intently, you possibly can see one cranium on the top-right of the shirt has been flipped.

No matter your cause for eager to determine the distinction two pictures, ImageMagick’s convert instrument is spectacular. You’ll be able to do one million issues with ImageMagick; take a look at my Media tutorials to study extra superior methods to switch pictures, movies, and audio!

  • Interview with a Pornhub Web Developer
  • CSS Gradients

    With CSS border-radius, I confirmed you the way CSS can bridge the hole between design and improvement by including rounded corners to parts.  CSS gradients are one other step in that path.  Now that CSS gradients are supported in Web Explorer 8+, Firefox, Safari, and Chrome…

  • Shake Things Up Using jQuery UI’s Shake Effect
  • Drag. Drop. Lock.

RELATED ARTICLES

Most Popular

Recent Comments