A command-line tool to visualize (Git?) differences between two images, rendered directly in your terminal.
The diff heatmap shows pixel differences using a color scale: black (identical) through blue, green, yellow to red (maximum difference). Magenta indicates regions where images differ in size.
imgap <image1> <image2>
Supports PNG, JPG, WebP, GIF, BMP, TIFF, SVG, and other common formats.
Pass -i for a full-screen TUI that overlays the two images with a keyboard-driven slider:
imgap -i <image1> <image2>
←/→— move the slider (holdShiftfor bigger steps)m— cycle comparison modes: 2-up, swipe, onion skin, differences— swap to the left-only view; press again for right-only;mreturns to the last comparison modeHome/End— jump to 0% / 100%q/Esc— quit
The difference mode renders the same heatmap shown in non-interactive output: black (identical) through blue, green, yellow to red (maximum difference), with magenta marking regions where the two images differ in size.
cargo install imgap
imgap auto-detects your terminal's image protocol:
- Kitty graphics protocol
- iTerm2 inline images (also WezTerm)
- Sixel (foot, xterm, mlterm, Windows Terminal, and others)
imgap also natively understands git's external diff calling convention (for the inline, non-interactive view) -- no wrapper script needed.
git config --global diff.image.command imgapIn your repository (or globally in ~/.config/git/attributes):
*.png diff=image
*.jpg diff=image
*.jpeg diff=image
*.webp diff=image
*.bmp diff=image
*.gif diff=image
*.svg diff=image
Git pipes diff output through a pager (typically less), which does not understand image escape sequences. To see inline images in git diff, use an image-aware pager like lessi:
git config --global pager.diff lessiNow git diff will show visual image comparisons inline in your terminal.
Once diff.image.command is configured (see Using with git diff below), git difftool works out of the box. imgap automatically enters interactive mode when git invokes it through difftool (it checks for GIT_DIFFTOOL_TRUST_EXIT_CODE in the environment), so plain git diff stays inline and static while git difftool pops the interactive TUI:
git difftool -- '**/*.png'If you don't want the git diff integration, register imgap as a named difftool instead:
git config --global difftool.imgap.cmd 'imgap -i "$LOCAL" "$REMOTE"'
git config --global difftool.prompt false
git difftool -t imgap -- '**/*.png'Either way, difftool opens each modified image in the interactive TUI one after another — press q to advance to the next file.
cargo build --release
The binary will be at target/release/imgap. No non-Rust dependencies required.