You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-operation.md
+19-23
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,15 @@
1
1
## rotate
2
2
> rotate([angle], [options]) ⇒ <code>Sharp</code>
3
3
4
-
Rotate the output image by either an explicit angle
5
-
or auto-orient based on the EXIF `Orientation` tag.
4
+
Rotate the output image.
6
5
7
-
If an angle is provided, it is converted to a valid positive degree rotation.
6
+
The provided angle is converted to a valid positive degree rotation.
8
7
For example, `-450` will produce a 270 degree rotation.
9
8
10
9
When rotating by an angle other than a multiple of 90,
11
10
the background colour can be provided with the `background` option.
12
11
13
-
If no angle is provided, it is determined from the EXIF data.
14
-
Mirroring is supported and may infer the use of a flip operation.
15
-
16
-
The use of `rotate` without an angle will remove the EXIF `Orientation` tag, if any.
12
+
For backwards compatibility, if no angle is provided, `.autoOrient()` will be called.
17
13
18
14
Only one rotation can occur per pipeline (aside from an initial call without
19
15
arguments to orient via EXIF data). Previous calls to `rotate` in the same
@@ -36,18 +32,6 @@ for example `.rotate(x).extract(y)` will produce a different result to `.extract
36
32
|[options]| <code>Object</code> || if present, is an Object with optional attributes. |
37
33
|[options.background]| <code>string</code> \| <code>Object</code> | <code>"\"#000000\""</code> | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
38
34
39
-
**Example**
40
-
```js
41
-
constpipeline=sharp()
42
-
.rotate()
43
-
.resize(null, 200)
44
-
.toBuffer(function (err, outputBuffer, info) {
45
-
// outputBuffer contains 200px high JPEG image data,
46
-
// auto-rotated using EXIF Orientation tag
47
-
// info.width and info.height contain the dimensions of the resized image
0 commit comments