Comparing version 0.19.0 to 0.19.1
@@ -21,2 +21,3 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
- [boolean](#boolean) | ||
- [linear](#linear) | ||
@@ -325,1 +326,15 @@ ## rotate | ||
Returns **Sharp** | ||
## linear | ||
Apply the linear formula a \* input + b to the image (levels adjustment) | ||
**Parameters** | ||
- `a` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** multiplier (optional, default `1.0`) | ||
- `b` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** offset (optional, default `0.0`) | ||
- Throws **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters | ||
Returns **Sharp** |
@@ -186,2 +186,3 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
- `tile.overlap` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** tile overlap in pixels, a value between 0 and 8192. (optional, default `0`) | ||
- `tile.angle` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** tile angle of rotation, must be a multiple of 90. (optional, default `0`) | ||
- `tile.container` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** tile container, with value `fs` (filesystem) or `zip` (compressed file). (optional, default `'fs'`) | ||
@@ -188,0 +189,0 @@ - `tile.layout` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** filesystem layout, possible values are `dz`, `zoomify` or `google`. (optional, default `'dz'`) |
@@ -166,2 +166,3 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
"_change the dimensions of the image only if its width or height exceeds the geometry specification_". | ||
Use with `max()` to preserve the image's aspect ratio. | ||
@@ -168,0 +169,0 @@ The default behaviour _before_ function call is `false`, meaning the image will be enlarged. |
@@ -7,2 +7,16 @@ # Changelog | ||
#### v0.19.1 - 24<sup>th</sup> February 2018 | ||
* Expose libvips' linear transform feature. | ||
[#1024](https://github.com/lovell/sharp/pull/1024) | ||
[@3epnm](https://github.com/3epnm) | ||
* Expose angle option for tile-based output. | ||
[#1121](https://github.com/lovell/sharp/pull/1121) | ||
[@BiancoA](https://github.com/BiancoA) | ||
* Prevent crop operation when image already at or below target dimensions. | ||
[#1134](https://github.com/lovell/sharp/issues/1134) | ||
[@pieh](https://github.com/pieh) | ||
#### v0.19.0 - 11<sup>th</sup> January 2018 | ||
@@ -9,0 +23,0 @@ |
@@ -108,2 +108,5 @@ # sharp | ||
* [Kenric D'Souza](https://github.com/AzureByte) | ||
* [Oleh Aleinyk](https://github.com/oaleynik) | ||
* [Marcel Bretschneider](https://github.com/3epnm) | ||
* [Andrea Bianco](https://github.com/BiancoA) | ||
@@ -110,0 +113,0 @@ Thank you! |
@@ -206,2 +206,4 @@ 'use strict'; | ||
tileOverlap: 0, | ||
linearA: 1, | ||
linearB: 0, | ||
// Function to notify of libvips warnings | ||
@@ -208,0 +210,0 @@ debuglog: debuglog, |
@@ -410,2 +410,29 @@ 'use strict'; | ||
/** | ||
* Apply the linear formula a * input + b to the image (levels adjustment) | ||
* @param {Number} [a=1.0] multiplier | ||
* @param {Number} [b=0.0] offset | ||
* @returns {Sharp} | ||
* @throws {Error} Invalid parameters | ||
*/ | ||
function linear (a, b) { | ||
if (!is.defined(a)) { | ||
this.options.linearA = 1.0; | ||
} else if (is.number(a)) { | ||
this.options.linearA = a; | ||
} else { | ||
throw new Error('Invalid linear transform multiplier ' + a); | ||
} | ||
if (!is.defined(b)) { | ||
this.options.linearB = 0.0; | ||
} else if (is.number(b)) { | ||
this.options.linearB = b; | ||
} else { | ||
throw new Error('Invalid linear transform offset ' + b); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Decorate the Sharp prototype with operation-related functions. | ||
@@ -431,3 +458,4 @@ * @private | ||
threshold, | ||
boolean | ||
boolean, | ||
linear | ||
].forEach(function (f) { | ||
@@ -434,0 +462,0 @@ Sharp.prototype[f.name] = f; |
@@ -322,2 +322,3 @@ 'use strict'; | ||
* @param {Number} [tile.overlap=0] tile overlap in pixels, a value between 0 and 8192. | ||
* @param {Number} [tile.angle=0] tile angle of rotation, must be a multiple of 90. | ||
* @param {String} [tile.container='fs'] tile container, with value `fs` (filesystem) or `zip` (compressed file). | ||
@@ -365,2 +366,11 @@ * @param {String} [tile.layout='dz'] filesystem layout, possible values are `dz`, `zoomify` or `google`. | ||
} | ||
// Angle of rotation, | ||
if (is.defined(tile.angle)) { | ||
if (is.integer(tile.angle) && !(tile.angle % 90)) { | ||
this.options.tileAngle = tile.angle; | ||
} else { | ||
throw new Error('Unsupported angle: angle must be a positive/negative multiple of 90 ' + tile.angle); | ||
} | ||
} | ||
} | ||
@@ -373,2 +383,3 @@ // Format | ||
} | ||
return this._updateFormatOut('dz'); | ||
@@ -375,0 +386,0 @@ } |
@@ -256,2 +256,3 @@ 'use strict'; | ||
* "*change the dimensions of the image only if its width or height exceeds the geometry specification*". | ||
* Use with `max()` to preserve the image's aspect ratio. | ||
* | ||
@@ -258,0 +259,0 @@ * The default behaviour *before* function call is `false`, meaning the image will be enlarged. |
{ | ||
"name": "sharp", | ||
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"author": "Lovell Fuller <npm@lovell.info>", | ||
@@ -42,6 +42,9 @@ "homepage": "https://github.com/lovell/sharp", | ||
"Matt Parrish <matt.r.parrish@gmail.com>", | ||
"Marcel Bretschneider <marcel.bretschneider@gmail.com>", | ||
"Matthew McEachen <matthew+github@mceachen.org>", | ||
"Jarda Kotěšovec <jarda.kotesovec@gmail.com>", | ||
"Kenric D'Souza <kenric.dsouza@gmail.com>", | ||
"Oleh Aleinyk <oleg.aleynik@gmail.com>" | ||
"Oleh Aleinyk <oleg.aleynik@gmail.com>", | ||
"Marcel Bretschneider <marcel.bretschneider@gmail.com>", | ||
"Andrea Bianco <andrea.bianco@unibas.ch>" | ||
], | ||
@@ -77,8 +80,8 @@ "scripts": { | ||
"dependencies": { | ||
"color": "^2.0.1", | ||
"color": "^3.0.0", | ||
"detect-libc": "^1.0.3", | ||
"nan": "^2.8.0", | ||
"semver": "^5.4.1", | ||
"nan": "^2.9.2", | ||
"semver": "^5.5.0", | ||
"simple-get": "^2.7.0", | ||
"tar": "^4.2.0", | ||
"tar": "^4.4.0", | ||
"tunnel-agent": "^0.6.0" | ||
@@ -89,9 +92,9 @@ }, | ||
"cc": "^1.0.1", | ||
"documentation": "^5.3.5", | ||
"documentation": "^5.4.0", | ||
"exif-reader": "^1.0.2", | ||
"icc": "^1.0.0", | ||
"mocha": "^4.1.0", | ||
"nyc": "^11.4.1", | ||
"mocha": "^5.0.1", | ||
"nyc": "^11.5.0", | ||
"rimraf": "^2.6.2", | ||
"semistandard": "^12.0.0", | ||
"semistandard": "^12.0.1", | ||
"unzip": "^0.1.11" | ||
@@ -98,0 +101,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1415605
2521
51
+ Addedcolor@3.2.1(transitive)
- Removedcolor@2.0.1(transitive)
Updatedcolor@^3.0.0
Updatednan@^2.9.2
Updatedsemver@^5.5.0
Updatedtar@^4.4.0