-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
With these two files, there are a few pixels that are different, but the visual diff does not color them in red.
However, magick::image_compare()
does show the differences.
oldfile <- "file1.png"
newfile <- "file2.png"
library(magick)
old <- magick::image_read(oldfile)
new <- magick::image_read(newfile)
# Shows difference
image_compare(old, new)
# Does not show difference
library(diffviewer)
diffviewer::visual_diff(oldfile, newfile)
This is the difference image generated by image_compare()
. I've added arrows pointing to the pixels that are different.
Here's the info about the pixels that are different:
old_data <- old[[1]]
new_data <- new[[1]]
idx <- old_data != new_data
which(idx, arr.ind = TRUE)
#> dim1 dim2 dim3
#> [1,] 1 512 185
#> [2,] 2 512 185
#> [3,] 3 512 185
#> [4,] 1 512 196
#> [5,] 2 512 196
#> [6,] 3 512 196
#> [7,] 1 1022 670
#> [8,] 2 1022 670
#> [9,] 3 1022 670
#> [10,] 1 1022 686
#> [11,] 2 1022 686
#> [12,] 3 1022 686
#> [13,] 1 1022 1136
#> [14,] 2 1022 1136
#> [15,] 3 1022 1136
old_data[idx]
#> [1] 0f 82 fe 0e 81 fe e6 e6 e6 d7 d7 d7 e6 e6 e6
new_data[idx]
#> [1] 00 7b ff 00 7b ff e7 e7 e7 d8 d8 d8 e7 e7 e7
cc @nstrayer
Metadata
Metadata
Assignees
Labels
No labels