mirror of
https://github.com/danbulant/pngjs
synced 2026-05-27 05:41:47 +00:00
Merge pull request #22 from gagern/deflateFactory
Help producing reproducible results
This commit is contained in:
commit
79409fb535
2 changed files with 3 additions and 1 deletions
|
|
@ -110,6 +110,7 @@ As input any color type is accepted (grayscale, rgb, palette, grayscale with alp
|
|||
- `deflateChunkSize` - chunk size used for deflating data chunks, this should be power of 2 and must not be less than 256 and more than 32*1024 (default: 32 kB)
|
||||
- `deflateLevel` - compression level for delate (default: 9)
|
||||
- `deflateStrategy` - compression strategy for delate (default: 3)
|
||||
- `deflateFactory` - deflate stream factory (default: `zlib.createDeflate`)
|
||||
- `filterType` - png filtering method for scanlines (default: -1 => auto, accepts array of numbers 0-4)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ var Packer = module.exports = function(options) {
|
|||
options.deflateChunkSize = options.deflateChunkSize || 32 * 1024;
|
||||
options.deflateLevel = options.deflateLevel != null ? options.deflateLevel : 9;
|
||||
options.deflateStrategy = options.deflateStrategy != null ? options.deflateStrategy : 3;
|
||||
options.deflateFactory = options.deflateFactory || zlib.createDeflate;
|
||||
|
||||
this.readable = true;
|
||||
};
|
||||
|
|
@ -37,7 +38,7 @@ Packer.prototype.pack = function(data, width, height, gamma) {
|
|||
var filteredData = filter(data, width, height, this._options);
|
||||
|
||||
// compress it
|
||||
var deflate = zlib.createDeflate({
|
||||
var deflate = this._options.deflateFactory({
|
||||
chunkSize: this._options.deflateChunkSize,
|
||||
level: this._options.deflateLevel,
|
||||
strategy: this._options.deflateStrategy
|
||||
|
|
|
|||
Loading…
Reference in a new issue