Skip to content

roblillack/imgap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imgap

Build Status Crates.io Downloads

A command-line tool to visualize differences between two images, rendered directly in your terminal.

imgap example using showing the diff between two PNG files

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.

Usage

imgap <image1> <image2>

Supports PNG, JPG, WebP, GIF, BMP, TIFF, and other common formats.

Install

cargo install imgap

Terminal support

imgap auto-detects your terminal's image protocol:

  • Kitty graphics protocol
  • iTerm2 inline images (also WezTerm)
  • Sixel (foot, xterm, mlterm, Windows Terminal, and others)

Using with git diff

imgap natively understands git's external diff calling convention -- no wrapper script needed.

1. Configure git

git config --global diff.image.command imgap

2. Set up .gitattributes

In 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

3. Use an image-aware pager

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 lessi

Now git diff will show visual image comparisons inline in your terminal.

Building from source

cargo build --release

The binary will be at target/release/imgap. No non-Rust dependencies required.

About

Terminal-based image diff tool which nicely integrates with `git diff` (using Sixel or Kitty graphics)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages