iTranslated by AI
Using ImageMagick for Image Difference Detection
Introduction
In web development, we perform markup based on designs, so it's necessary to verify that the final screen displayed in the browser matches the design.
Additionally, even when making design corrections to existing sites, we need to confirm what parts of the design have been changed.
Since manually checking for differences in such cases is quite difficult, I'm going to try imageMagick.
Installing imageMagick
Several installation methods are listed on the official website, but I will install it via Homebrew.
brew install imagemagick
Confirming that it was installed correctly.
convert -version
Testing image differences with composite
You can compare images using composite.
composite -compose difference {comparison_image_A} {comparison_image_B} {output_result}
When there is no difference
The output is produced such that the more similar the colors in the compared areas are, the closer they are to black. Thus, if there is no difference, the resulting image will be completely black.
Let's try comparing the same image against itself as a test.
composite -compose difference imageA.jpeg imageA.jpeg diff.jpg
Comparison image imageA.jpeg

Output result diff.jpeg

When there are differences
Areas where there is a color difference between the compared parts will be output in colors other than black.
Comparison image imageA.jpeg

Comparison image imageB.jpeg

Output result diff.jpeg

Trying it out on an actual site
I'll try it with images from an actual site.
I'll use the Zenn profile screen as a sample image.
Note: I'm using the Chrome extension GoWebPage to capture the entire web page.
When only text or images are changed without margin modifications
I'll try comparing after changing some of the text and emojis.
composite -compose difference Zenn_A.jpeg Zenn_B.jpeg diff.jpg
Comparison image Zenn_A.jpeg

Comparison image Zenn_B.jpeg (with minor changes to emojis and text)

Output result diff.jpeg

Since only the changed parts of the text or emojis are output, the modifications are obvious at a glance.
When there are changes in margins
I'll try changing only the margins of elements at the top of the page while keeping the text as is.
composite -compose difference Zenn_A.jpeg Zenn_C.jpeg diff.jpg
Comparison image Zenn_A.jpeg

Comparison image Zenn_C.jpeg

Output result diff.jpeg

When margins are changed, a large number of differences are output, making it impractical as a method for detecting misalignments.
Conclusion
For the purpose of comparing designs, it seems there aren't many opportunities where imageMagick can be used...
In the first place, I feel that minor design corrections or wording changes can be managed through communication.
Ultimately, visual confirmation is required anyway, so I feel it might be better to use a Chrome extension like visual-inspector rather than comparing via images.
...Or so I thought, but I found out that visual-inspector had been removed due to a Chrome policy violation...
References
Discussion