@@ -144,6 +144,7 @@ const buildDiffImage = (png1, png2, options, callback) => {
144144 const minWidth = Math . min ( png1 . width , png2 . width ) ;
145145 const minHeight = Math . min ( png1 . height , png2 . height ) ;
146146 const highlightColor = options . highlightColor ;
147+ const alphaLevel = isNaN ( options . transparency ) ? 255 : options . transparency ;
147148 const result = png . empty ( width , height ) ;
148149
149150 iterateRect ( width , height , ( x , y ) => {
@@ -158,7 +159,7 @@ const buildDiffImage = (png1, png2, options, callback) => {
158159 if ( ! options . comparator ( { color1, color2} ) ) {
159160 result . setPixel ( x , y , highlightColor ) ;
160161 } else {
161- result . setPixel ( x , y , color1 ) ;
162+ result . setPixel ( x , y , color1 , alphaLevel ) ;
162163 }
163164 } , ( ) => callback ( result ) ) ;
164165} ;
@@ -216,7 +217,8 @@ exports.createDiff = function saveDiff(opts, callback) {
216217
217218 const diffOptions = {
218219 highlightColor : parseColorString ( opts . highlightColor ) ,
219- comparator : opts . strict ? areColorsSame : makeCIEDE2000Comparator ( tolerance )
220+ comparator : opts . strict ? areColorsSame : makeCIEDE2000Comparator ( tolerance ) ,
221+ transparency : opts . transparency
220222 } ;
221223
222224 buildDiffImage ( result . first , result . second , diffOptions , ( result ) => {
0 commit comments