Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit4.readnews.com!panix!not-for-mail From: john hevelin Newsgroups: comp.sys.mac.system Subject: Re: Any quick, easy way to compare two images? Date: Fri, 24 Jan 2014 01:57:43 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 18 Message-ID: References: <230120141424174937%nospam@nospam.invalid> NNTP-Posting-Host: panix1.panix.com X-Trace: reader1.panix.com 1390528663 20987 166.84.1.1 (24 Jan 2014 01:57:43 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Fri, 24 Jan 2014 01:57:43 +0000 (UTC) User-Agent: tin/2.0.0-20110823 ("Ardenistiel") (UNIX) (NetBSD/6.1.2 (i386)) Xref: csiph.com comp.sys.mac.system:55252 Don Bruder wrote: > I think that's likely going to be the way to go - I actually get handed > a wad of NSData that I then feed to NSImage to create the actual image, > so if I save the raw data to PreviousImage, then XOR it against the > "NewImage" data (before feeding it to NSImage), it should be simple > enough. Better yet, just grab the same range of bytes from each, rather > than doing the full data buffer... I know nothing about your problem domain, but if what you want to do is compare two sets of bytes for equality, and you don't have metadata such as timestamps, why not use cmp(1)? It does a byte-by-byte comparison and terminates at the first inequality. Your worst case would be if the two sets are identical, since cmp would read both files in their entirety. I wouldn't use diff(1) -- diff would report all the detected differences between the two sets, which could be considerable.