Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jpeg-js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpeg-js - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

test/fixtures/apsara.jpg

18

lib/decoder.js

@@ -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');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc