yahoo / blink-diff

A lightweight image comparison tool.
http://yahoo.github.io/blink-diff/
MIT License
1.21k stars 90 forks source link

Invalid file signature #18

Closed reggi closed 9 years ago

reggi commented 9 years ago

Output:

thomas@workstation:goldshelf$ node compare.js 
{ _imageA: undefined,
  _imageAPath: '/Users/thomas/Desktop/goldshelf/learn/input.jpg',
  _imageB: undefined,
  _imageBPath: '/Users/thomas/Desktop/goldshelf/learn/desired.jpg',
  _imageOutput: null,
  _imageOutputPath: '/Users/thomas/Desktop/goldshelf/output-diff/',
  _imageOutputLimit: 100,
  _thresholdType: 'percent',
  _threshold: 0.01,
  _delta: 20,
  _outputMaskRed: 255,
  _outputMaskGreen: 0,
  _outputMaskBlue: 0,
  _outputMaskAlpha: 255,
  _outputMaskOpacity: 0.7,
  _outputBackgroundRed: 0,
  _outputBackgroundGreen: 0,
  _outputBackgroundBlue: 0,
  _outputBackgroundAlpha: undefined,
  _outputBackgroundOpacity: 0.6,
  _outputShiftRed: 200,
  _outputShiftGreen: 100,
  _outputShiftBlue: 0,
  _outputShiftAlpha: 255,
  _outputShiftOpacity: 0.7,
  _blockOut: [],
  _blockOutRed: 0,
  _blockOutGreen: 0,
  _blockOutBlue: 0,
  _blockOutAlpha: 255,
  _blockOutOpacity: 1,
  _copyImageAToOutput: true,
  _copyImageBToOutput: false,
  _filter: [],
  _debug: false,
  _composition: true,
  _composeLeftToRight: false,
  _composeTopToBottom: false,
  _hShift: 2,
  _vShift: 2,
  _cropImageA: undefined,
  _cropImageB: undefined,
  _refWhite: { c1: 1, c2: 1, c3: 1, c4: 1 },
  _perceptual: false,
  _gamma: undefined,
  _gammaR: undefined,
  _gammaG: undefined,
  _gammaB: undefined }
Invalid file signature
Error: Invalid file signature
    at Parser._parseSignature (/Users/thomas/Desktop/goldshelf/node_modules/blink-diff/node_modules/pngjs-image/node_modules/pngjs/lib/parser.js:87:32)
    at ChunkStream._process (/Users/thomas/Desktop/goldshelf/node_modules/blink-diff/node_modules/pngjs-image/node_modules/pngjs/lib/chunkstream.js:186:23)
    at ChunkStream.write (/Users/thomas/Desktop/goldshelf/node_modules/blink-diff/node_modules/pngjs-image/node_modules/pngjs/lib/chunkstream.js:74:10)
    at PNG.write (/Users/thomas/Desktop/goldshelf/node_modules/blink-diff/node_modules/pngjs-image/node_modules/pngjs/lib/png.js:100:18)
    at ReadStream.ondata (_stream_readable.js:524:20)
    at emitOne (events.js:77:13)
    at ReadStream.emit (events.js:166:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at ReadStream.Readable.push (_stream_readable.js:109:10)
    at onread (fs.js:1726:12)

Code:

var path = require("path")
var BlinkDiff = require("blink-diff")

var input = path.join(__dirname, "./learn/input.jpg")
var desired = path.join(__dirname, "./learn/desired.jpg")
var output = path.join(__dirname, "./output-diff/")

var diff = new BlinkDiff({
    imageAPath: input,
    imageBPath: desired,
    thresholdType: BlinkDiff.THRESHOLD_PERCENT,
    threshold: 0.01,
    imageOutputPath: output
});

console.log(diff)

diff.run(function (error, result) {
   if (error) {
      throw error;
   } else {
      console.log(diff.hasPassed(result.code) ? 'Passed' : 'Failed');
      console.log('Found ' + result.differences + ' differences.');
   }
});
reggi commented 9 years ago

Converted them to PNG's using sips http://osxdaily.com/2013/01/11/converting-image-file-formats-with-the-command-line-sips/