Skip to content

DiffImageResult

FieldTypeWhat it is
widthnumberintThe frame both pictures were compared in.
heightnumberint
beforeDiffImageAreaWhere the first picture sits in that frame.
afterDiffImageAreaWhere the second one sits.
offset{ x, y }DiffImageOffsetHow far the second was moved to line the two up.
maskUint8ListWhat happened to each pixel of the frame, row by row.
regionsDiffImageRegion[]List<DiffImageRegion>Where the changes are, in reading order.
statsDiffImageStatsHow much of the frame ended up where.
completebooleanboolWhether the list of regions holds all of them.

A byte of mask is an index into DIFF_PIXEL_KINDSkDiffPixelKinds, which is ['equal', 'changed', 'added', 'removed'][DiffPixelKind.equal, .changed, .added, .removed] — so 0 is a pixel that did not change and anything else is a pixel that did.

offset is where the move went rather than where the contents were: a picture drawn a pixel further to the right than the first is moved a pixel to the left, and x is -1.

Released under the MIT License