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

pngjs

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pngjs - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

lib/sync-inflate.js

0

lib/format-normaliser.js

@@ -0,0 +0,0 @@ 'use strict';

@@ -49,8 +49,44 @@ 'use strict';

if (!this._inflate) {
this._inflate = zlib.createInflate();
if (this._bitmapInfo.interlace) {
this._inflate = zlib.createInflate();
this._inflate.on('error', this.emit.bind(this, 'error'));
this._filter.on('complete', this._complete.bind(this));
this._inflate.on('error', this.emit.bind(this, 'error'));
this._filter.on('complete', this._complete.bind(this));
this._inflate.pipe(this._filter);
this._inflate.pipe(this._filter);
} else {
var rowSize = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7) >> 3) + 1;
var imageSize = rowSize * this._bitmapInfo.height;
var chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK);
this._inflate = zlib.createInflate({ chunkSize: chunkSize });
var leftToInflate = imageSize;
var emitError = this.emit.bind(this, 'error');
this._inflate.on('error', function(err) {
if (!leftToInflate) {
return;
}
emitError(err);
});
this._filter.on('complete', this._complete.bind(this));
var filterWrite = this._filter.write.bind(this._filter);
this._inflate.on('data', function(chunk) {
if (!leftToInflate) {
return;
}
if (chunk.length > leftToInflate) {
chunk = chunk.slice(0, leftToInflate);
}
leftToInflate -= chunk.length;
filterWrite(chunk);
});
this._inflate.on('end', this._filter.end.bind(this._filter));
}
}

@@ -57,0 +93,0 @@ this._inflate.write(data);

@@ -5,2 +5,3 @@ 'use strict';

var zlib = require('zlib');
var inflateSync = require('./sync-inflate');
var SyncReader = require('./sync-reader');

@@ -70,3 +71,10 @@ var FilterSync = require('./filter-parse-sync');

var inflatedData = zlib.inflateSync(inflateData);
var inflatedData;
if (metaData.interlace) {
inflatedData = zlib.inflateSync(inflateData);
} else {
var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1;
var imageSize = rowSize * metaData.height;
inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize });
}
inflateData = null;

@@ -73,0 +81,0 @@

1

lib/parser.js

@@ -35,3 +35,2 @@ 'use strict';

this.inflateData = dependencies.inflateData;
this.inflateData = dependencies.inflateData;
this.finished = dependencies.finished;

@@ -38,0 +37,0 @@ };

{
"name": "pngjs",
"version": "3.0.1",
"version": "3.1.0",
"description": "PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite.",

@@ -15,3 +15,4 @@ "contributors": [

"Michael Vogt",
"Xin-Xin Wang"
"Xin-Xin Wang",
"toriningen"
],

@@ -18,0 +19,0 @@ "homepage": "https://github.com/lukeapage/pngjs",

@@ -210,3 +210,3 @@ [![Build Status](https://travis-ci.org/lukeapage/pngjs.svg?branch=master)](https://travis-ci.org/lukeapage/pngjs) [![Build status](https://ci.appveyor.com/api/projects/status/tb8418jql1trkntd/branch/master?svg=true)](https://ci.appveyor.com/project/lukeapage/pngjs2/branch/master) [![Coverage Status](https://coveralls.io/repos/lukeapage/pngjs2/badge.svg?branch=master&service=github)](https://coveralls.io/github/lukeapage/pngjs2?branch=master) [![npm version](https://badge.fury.io/js/pngjs.svg)](http://badge.fury.io/js/pngjs)

## Packing a PNG and removing alpga (RGBA to RGB)
## Packing a PNG and removing alpha (RGBA to RGB)

@@ -273,2 +273,5 @@ When removing the alpha channel from an image, there needs to be a background color to correctly

### 3.1.0 - 30/04/2017
- Support for pngs with zlib chunks that are malformed after valid data
### 3.0.1 - 16/02/2017

@@ -275,0 +278,0 @@ - Fix single pixel pngs

Sorry, the diff of this file is not supported yet

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