News for hackers. Stuff that matters.
Re:Imgdiff: Faster than the fastest pixel-by-pixel image dif... by dheera on Saturday December 12, 2020 @06:33PM (#25402812)
I'm finding "gm compare" to be faster.

    $ time ./imgdiff cypress.png cypress.png         
    Success! Images are equal.
    3.22user 0.10system 0:00.50elapsed 661%CPU 
    (0avgtext+0avgdata 478524maxresident)k
    0inputs+0outputs (0major+48339minor)pagefaults 0swaps
    
    $ time gm compare -highlight-style assign -highlight-color purple -file diff.png cypress.png cypress.png                                             
    1.99user 0.21system 0:02.21elapsed 99%CPU 
    (0avgtext+0avgdata 874948maxresident)k
    0inputs+5240outputs (0major+217173minor)pagefaults 0swaps

    $ time gm compare -metric mse cypress.png cypress.png                                                                                                
    Image Difference (MeanSquaredError):
               Normalized    Absolute
              ============  ==========
         Red: 0.0000000000        0.0
       Green: 0.0000000000        0.0
        Blue: 0.0000000000        0.0
     Opacity: 0.0000000000        0.0
       Total: 0.0000000000        0.0
    0.94user 0.14system 0:00.67elapsed 161%CPU 
    (0avgtext+0avgdata 585832maxresident)k
    0inputs+0outputs (0major+144881minor)pagefaults 0swaps
Re:Imgdiff: Faster than the fastest pixel-by-pixel image dif... by jihchi on Saturday December 12, 2020 @07:41PM (#25403222)
Were you comparing two identical image? Could you try two different image?
Re:Imgdiff: Faster than the fastest pixel-by-pixel image dif... by noahtallen on Saturday December 12, 2020 @08:28PM (#25403460)
To really see how these algorithms perform, you should compare the worst case for the algorithm. In order to see if a picture is identical, you’d have to loop through every single pixel, which is the worst case. But you can shortcut on the first pixel which is different, which I imagine happens pretty quickly on many generic pictures. So testing performance with two different images is probably not best for comparison.
Re:Imgdiff: Faster than the fastest pixel-by-pixel image dif... by acdha on Saturday December 12, 2020 @09:16PM (#25403736)
You can only short-circuit if you’re returning a Boolean. If you need to do what these tools and return some metric for the degree of difference you still have to process both images in entirety.