Comparing version 0.0.4 to 0.1.0
@@ -967,14 +967,12 @@ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / | ||
decoder.parse(arr); | ||
var data = decoder.getData(decoder.width, decoder.height); | ||
var buf = new Buffer(decoder.width * decoder.height * 4); | ||
var n = 0; | ||
for (var i = 0; i < buf.length; i++) { | ||
buf[i + (i/3 | 0)] = data[n++]; | ||
if (i % 4 == 3) buf[i] = 255; | ||
} | ||
return { | ||
data: buf, | ||
var image = { | ||
width: decoder.width, | ||
height: decoder.height | ||
height: decoder.height, | ||
data: new Buffer(decoder.width * decoder.height * 4) | ||
}; | ||
decoder.copyToImageData(image); | ||
return image; | ||
} |
{ | ||
"name": "jpeg-js", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "A pure javascript JPEG encoder and decoder", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -41,2 +41,13 @@ var redtape = require('redtape'), | ||
it('should be able to decode a grayscale JPEG', function(t) { | ||
var jpegData = fixture('apsara.jpg'); | ||
var rawImageData = jpeg.decode(jpegData); | ||
t.equal(rawImageData.width, 580); | ||
t.equal(rawImageData.height, 599); | ||
var expected = fixture('apsara.rgba'); | ||
t.deepEqual(rawImageData.data, expected); | ||
t.end(); | ||
}); | ||
it('should be able to encode a JPEG', function (t) { | ||
@@ -43,0 +54,0 @@ var frameData = fixture('grumpycat.rgba'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1776133
16
1670