What algorithm can be used to mark up image files?

Please note that I am not asking to create "visual diff" image files. I ask if there is a diff / patch Unix command line utility that works well for image files.

So far I have tried bsdiff and xdelta on two image files. One file is an 8000x8000 image and uses the Gimp random noise visualizer. Another is the same picture with some blue lines drawn on it for a somewhat realistic test.

Here are my results:

$ time xdelta3 -e -s 1.png 2.png xdelta.patch

real    0m1.222s
user    0m1.106s
sys     0m0.114s

$ time bsdiff 1.png 2.png bsdiff.patch

real    0m20.860s
user    0m20.694s
sys     0m0.169s

$ ls -l 1.png 2.png xdelta.patch bsdiff.patch 
-rw-r--r-- 1 mardok mardok 6278160 May 20 20:21 1.png
-rw-r--r-- 1 mardok mardok 6669305 May 20 20:32 2.png
-rw-r--r-- 1 mardok mardok 6682740 May 20 21:06 bsdiff.patch
-rw-r--r-- 1 mardok mardok 6678609 May 20 21:05 xdelta.patch

No tool is suitable for work, because the fixes are larger than the images themselves. bsdiff is especially not suitable for work because it took 20 seconds.

So, is there any other algorithm that can be used to compare images?

EDIT: , .xcf Gimp. .

$ ls -l 1.xcf 2.xcf xcf.bsdiff xcf.xdelta 
-rw-r--r-- 1 mardok mardok 54693130 May 20 21:38 1.xcf
-rw-r--r-- 1 mardok mardok 53575879 May 20 21:38 2.xcf
-rw-r--r-- 1 mardok mardok  2758826 May 20 21:39 xcf.bsdiff
-rw-r--r-- 1 mardok mardok  3912197 May 20 21:41 xcf.xdelta

xcf , PNG, diff . , , PNG - . , , , PNG, JPG, TIFF .

EDIT2: JPEG:

$ ls -l 1.jpg 2.jpg jpg.bsdiff jpg.xdelta 
-rw-r--r-- 1 mardok mardok 2134569 May 20 21:49 1.jpg
-rw-r--r-- 1 mardok mardok 4509765 May 20 21:49 2.jpg
-rw-r--r-- 1 mardok mardok 3417896 May 20 21:50 jpg.bsdiff
-rw-r--r-- 1 mardok mardok 3917899 May 20 21:50 jpg.xdelta

, bsdiff , diff JPEG. diff, . , , , .

: bsdiff , JPEG . .

EDIT3: , TIFF:

$ ls -l 1.tiff 2.tiff tiff.xdelta tiff.bsdiff 
-rw-r--r-- 1 mardok mardok 10182924 May 20 21:56 1.tiff
-rw-r--r-- 1 mardok mardok 11069486 May 20 21:56 2.tiff
-rw-r--r-- 1 mardok mardok 11077784 May 20 21:57 tiff.bsdiff
-rw-r--r-- 1 mardok mardok 11054104 May 20 21:56 tiff.xdelta

, PNG. .

, diff . ?

+4
1

. , .

, , PNG , . .

, , , . , .

, , , , , . , , , , .

+2

Source: https://habr.com/ru/post/1541365/


All Articles