Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Spaceman Diff: Diffing Images on the Command Line (github.com/holman)
84 points by goranmoomin on July 28, 2019 | hide | past | favorite | 16 comments


5 stars.

This is the best utility to detect if your image has been transmogrified.


You can also use ImageMagick to generate a "diff" image:

magick compare img1.jpg img2.jpg diff.jpg

If you want a numeric result, you can use "-metric AE" (and a null output file) to count the number of pixels that differ.

There is also a "fuzz" option: -fuzz 2%


I think he's referencing to the Calvin and Hobbes Transmogrifier. The name of the util reminds of one of the personalities of Calvin : Spaceman Spiff


I wrote a command line utility for finding duplicate images: https://github.com/nickaubert/pdupe

Useful if you're trying to reorganize pictures after migrating out of one photo management service or another that may have resized images or altered the resolution. It doesn't attempt to display the images (that's what feh or imv are for), it only quantifies images' similarity.

I based on the logic on Geeqie's tool for finding similar images. My tool doesn't do anything that Geequie doesn't, except mine is run from the CLI.


> ImageMagick can do everything from image conversion to probably running a nuclear reactor.

Please, someone chime in that they use 'convert' in some process at a reactor site.


At my first job, our lab worked closely with the local TRIGA research reactor, and I did write and run some Java code that analyzed data collected in it. The Java license has always prohibited its use in nuclear reactors, but I figured a little offline analysis would be OK. The results didn't influence the use of radiation in any way.

ImageMagick is old enough and I used it regularly back in the day, but I think (it's been 20 years) most of the data I got was just raw numbers so there probably wouldn't have been much call for it.

I was also working on some (non-nuclear) image processing algorithms at the time, so it's quite likely I ran 'convert' on my laptop while inside the reactor building.


> The Java license has always prohibited its use in nuclear reactors, but I figured a little offline analysis would be OK

https://www.oracle.com/technetwork/java/javase/downloads/jdk... has:

3. RESTRICTIONS ... You acknowledge that Licensed Software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility.


For those to who it isn't obvious...the name is a pun on Calvin's imaginary alterego "Spaceman Spiff" in the comic Calvin & Hobbes.


Wish he just used tiv, it's a far superior terminal image viewer



https://github.com/stefanhaustein/TerminalImageViewer is amazing (but requires high-ascii font support from your term). And it's easy to install: `sudo snap install --edge tiv`


Couldn't you use Sixel to display pictures in the terminal?


Would it be better if checksum the images ? Unless we want to actually see the actual changes between the two.


Git is already checksumming the images. This utility is for looking at the actual changes in case the checksums differ.


Checksumming JPEG files is not that useful (to me, at least). There are lots of cases where the file checksum doesn't match but the image is still the same, for some definition of "same."

Examples:

EXIF/IPTC/etc metadata changes (sometimes this matters; sometimes it doesn't).

Image has been rotated (this almost never matters).

Image saved with different compression parameters (usually this matters but not always).

Image saved with different resolution (ditto).

Image has been slightly edited.

The point here is that with images, data identity does not always equal file identity.


Zounds!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: