IMGDIFF(1)
π IMGDIFF(1) β the BRL-CAD girlie's guide to image diffing β¨
okay so bestie, welcome to imgdiff, brought to you by the BRL-CAD fam π«Ά. This is the lil tool that looks at two images and tells you exactly how much they disagree, pixel by pixel, channel by channel. No cap. Let's get into it π
β¨ NAME β¨
imgdiff β compare two images and report or visualize their differences π
πΈ SYNOPSIS πΈ
imgdiff [options] img1 img2 [output]
π¦ DESCRIPTION π¦
So what does imgdiff actually do? It takes two images, img1 and img2, and compares them on a per-channel, per-pixel basis. Then it reports how many channels match exactly, how many differ by one unit, and how many differ by more than one unit. It's giving very meticulous, very detail-oriented, main character energy π
Input images are read through the libicv image library, which means literally any format libicv understands can be compared β we're talking pix(5), bw(5), and PNG, iykyk π. And plot twist that slays: the two inputs don't even need to be the same format. Mix and match, bestie π
The image format is normally inferred from each file's extension. For raw formats that carry no embedded dimensions β that's pix(5) and bw(5) β imgdiff tries to deduce the width and height from the file size. When that fails (π), you have to supply the dimensions explicitly. No guessing, no vibes, just numbers.
If you give an output path (either with -o or as a third positional argument) and the images differ, a difference image gets written that highlights the disagreeing pixels π₯. And when PNG render metadata is present, imgdiff can also compare that metadata and emit nirt(1) shotline scripts that re-trace the differing pixels β perfect for debugging renders, lowkey iconic.
π OPTIONS π
-h,βhelp,-?β print a usage summary and dip. That's it, that's the whole option βοΈ-o file,βoutput fileβ write the difference image tofile. Equivalent to passingoutputas a third positional argument. β οΈ Heads up bestie: the file must not already exist. So don't come crying to me if it errors out π-n prefix,βnirt-output prefixβ writenirt(1)shotline scripts for the differing pixels. You get one file per image that carries PNG render metadata:prefix\_img1.nirtand/or_prefix\_img2.nirtπ―βwidth-img1 #β width in pixels of the first image. For raw formats lacking embedded size, this is your girl π«Άβheight-img1 #β height in pixels of the first image.βwidth-img2 #β width in pixels of the second image.βheight-img2 #β height in pixels of the second image.βformat-img1 formatβ override the auto-detected file format of the first input image. Because sometimes the extension is lying to you πβformat-img2 formatβ override the auto-detected file format of the second input image.βoutput-format formatβ override the auto-detected file format of the output image.-A,βapproximateβ instead of the per-channel report, compute an approximate perceptual difference metric and print the Hamming distance between the two images. It's giving "I don't need the details, just the number" β¨-m,βmetadataβ compare embedded render metadata (PNG only) and report whether it's identical or differs. Metadata girlies rise πΈ
π EXAMPLES π
Example 1. Visualize the difference between two renders
imgdiff -o changed.png baseline.png current.png
Compares two PNG renders pixel by pixel, prints how many channels match or differ, and β if they differ β writes changed.png highlighting exactly which pixels changed π₯. Super useful for spotting regressions in rt(1) output. Obsessed, honestly.
Example 2. Compare raw pix images of known size and trace differing pixels
imgdiff --width-img1 512 --height-img1 512 \
--width-img2 512 --height-img2 512 \
-n shots ref.pix new.pix
Compares two 512x512 pix(5) images whose dimensions cannot be inferred from the file (so we're telling it manually, because we're helpful like that π
), and β for any image carrying render metadata β writes nirt(1) shotline scripts (shots_img1.nirt, shots_img2.nirt) that re-fire rays through the differing pixels π
π SEE ALSO π
brlcad(1), nirt(1), rt(1), pix-png(1), pixdiff(1), pix(5), bw(5)
Go read them, they're all part of the same friend group fr fr π«Ά
π AUTHOR π
BRL-CAD Team
β COPYRIGHT β
This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.
π BUG REPORTS π
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org π§. Not me personally, bestie β the devs. They got you π
k that's the whole page!! π¦ this gloriousness is IMGDIFF(1) from the BRL-CAD manual β mwah, go diff some images, you're gonna slay β¨π
π
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms