Skip to content

Commit

Permalink
Logging errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rc1 committed Jul 25, 2012
1 parent c3d8c55 commit 692acae
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/colour-extractor.coffee
Expand Up @@ -10,13 +10,15 @@ exports.topColours = (sourceFilename, sorted, cb) ->
img = gm(sourceFilename)
tmpFilename = temp.path({suffix: '.miff'})
img.size((err, wh) ->
console.log err if err
ratio = wh.width/MAX_W
w2 = wh.width/2
h2 = wh.height/2
img.bitdepth(8) # Initial colour reduction, prob. smarter than our 'algorithm'
.crop(w2, h2, w2/2, w2/2) # Center should be the most interesting
.scale(Math.ceil(wh.height/ratio), MAX_W) # Scales the image, histogram generation can take some time
.write('histogram:' + tmpFilename, (err) ->
console.log err if err
histogram = ''
miffRS = fs.createReadStream(tmpFilename, {encoding: 'utf8'})

Expand Down

0 comments on commit 692acae

Please sign in to comment.