diff --git a/docs/api-operation.md b/docs/api-operation.md index 3e91be97..07b98837 100644 --- a/docs/api-operation.md +++ b/docs/api-operation.md @@ -8,8 +8,8 @@ or auto-orient based on the EXIF `Orientation` tag. If an angle is provided, it is converted to a valid positive degree rotation. For example, `-450` will produce a 270deg rotation. -If an angle that is not a multiple of 90 is provided, the color of the -background color can be provided with the `background` option. +When rotating by an angle other than a multiple of 90, +the background colour can be provided with the `background` option. If no angle is provided, it is determined from the EXIF data. Mirroring is supported and may infer the use of a flip operation. @@ -21,7 +21,7 @@ for example `rotate(x).extract(y)` will produce a different result to `extract(y ### Parameters -- `angle` **[Number][1]** angle of rotation, must be a multiple of 90. (optional, default `auto`) +- `angle` **[Number][1]** angle of rotation. (optional, default `auto`) - `options` **[Object][2]?** if present, is an Object with optional attributes. - `options.background` **([String][3] \| [Object][2])** parsed by the [color][4] module to extract values for red, green, blue and alpha. (optional, default `"#000000"`) diff --git a/docs/changelog.md b/docs/changelog.md index 441d6553..bac3a8aa 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -15,6 +15,10 @@ Requires libvips v8.7.0. * Add experimental prebuilt binaries for musl-based Linux. [#1379](https://github.com/lovell/sharp/issues/1379) +* Add support for arbitrary rotation angle via vips_rotate. + [#1385](https://github.com/lovell/sharp/pull/1385) + [@freezy](https://github.com/freezy) + ### v0.20 - "*prebuild*" Requires libvips v8.6.1. diff --git a/docs/index.md b/docs/index.md index 9235cef5..19677b38 100644 --- a/docs/index.md +++ b/docs/index.md @@ -118,6 +118,7 @@ the help and code contributions of the following people: * [Alun Davies](https://github.com/alundavies) * [Aidan Hoolachan](https://github.com/ajhool) * [Axel Eirola](https://github.com/aeirola) +* [Freezy](https://github.com/freezy) Thank you! diff --git a/lib/operation.js b/lib/operation.js index 8c0b54b7..71186158 100644 --- a/lib/operation.js +++ b/lib/operation.js @@ -10,8 +10,8 @@ const is = require('./is'); * If an angle is provided, it is converted to a valid positive degree rotation. * For example, `-450` will produce a 270deg rotation. * - * If an angle that is not a multiple of 90 is provided, the color of the - * background color can be provided with the `background` option. + * When rotating by an angle other than a multiple of 90, + * the background colour can be provided with the `background` option. * * If no angle is provided, it is determined from the EXIF data. * Mirroring is supported and may infer the use of a flip operation. @@ -32,7 +32,7 @@ const is = require('./is'); * }); * readableStream.pipe(pipeline); * - * @param {Number} [angle=auto] angle of rotation, must be a multiple of 90. + * @param {Number} [angle=auto] angle of rotation. * @param {Object} [options] - if present, is an Object with optional attributes. * @param {String|Object} [options.background="#000000"] parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. * @returns {Sharp} @@ -55,7 +55,7 @@ function rotate (angle, options) { ]; } } else { - throw new Error('Unsupported angle: angle must be a number.'); + throw new Error('Unsupported angle: must be a number.'); } return this; } diff --git a/package.json b/package.json index 520c0cbc..fdd0f055 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,8 @@ "Sylvain Dumont ", "Alun Davies ", "Aidan Hoolachan ", - "Axel Eirola " + "Axel Eirola ", + "Freezy " ], "scripts": { "install": "(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)",