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: lib/index.d.ts
+57-9Lines changed: 57 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -364,24 +364,72 @@ declare namespace sharp {
364
364
//#region Operation functions
365
365
366
366
/**
367
-
* Rotate the output image by either an explicit angle or auto-orient based on the EXIF Orientation tag.
367
+
* Rotate the output image by either an explicit angle
368
+
* or auto-orient based on the EXIF `Orientation` tag.
368
369
*
369
-
* If an angle is provided, it is converted to a valid positive degree rotation. For example, -450 will produce a 270deg rotation.
370
+
* If an angle is provided, it is converted to a valid positive degree rotation.
371
+
* For example, `-450` will produce a 270 degree rotation.
370
372
*
371
-
* When rotating by an angle other than a multiple of 90, the background colour can be provided with the background option.
373
+
* When rotating by an angle other than a multiple of 90,
374
+
* the background colour can be provided with the `background` option.
372
375
*
373
-
* If no angle is provided, it is determined from the EXIF data. Mirroring is supported and may infer the use of a flip operation.
376
+
* If no angle is provided, it is determined from the EXIF data.
377
+
* Mirroring is supported and may infer the use of a flip operation.
374
378
*
375
-
* The use of rotate implies the removal of the EXIF Orientation tag, if any.
379
+
* The use of `rotate` without an angle will remove the EXIF `Orientation` tag, if any.
376
380
*
377
-
* Method order is important when both rotating and extracting regions, for example rotate(x).extract(y) will produce a different result to extract(y).rotate(x).
378
-
* @param angle angle of rotation. (optional, default auto)
379
-
* @param options if present, is an Object with optional attributes.
381
+
* Only one rotation can occur per pipeline (aside from an initial call without
382
+
* arguments to orient via EXIF data). Previous calls to `rotate` in the same
383
+
* pipeline will be ignored.
384
+
*
385
+
* Multi-page images can only be rotated by 180 degrees.
386
+
*
387
+
* Method order is important when rotating, resizing and/or extracting regions,
388
+
* for example `.rotate(x).extract(y)` will produce a different result to `.extract(y).rotate(x)`.
389
+
*
390
+
* @example
391
+
* const pipeline = sharp()
392
+
* .rotate()
393
+
* .resize(null, 200)
394
+
* .toBuffer(function (err, outputBuffer, info) {
395
+
* // outputBuffer contains 200px high JPEG image data,
396
+
* // auto-rotated using EXIF Orientation tag
397
+
* // info.width and info.height contain the dimensions of the resized image
398
+
* });
399
+
* readableStream.pipe(pipeline);
400
+
*
401
+
* @example
402
+
* const rotateThenResize = await sharp(input)
403
+
* .rotate(90)
404
+
* .resize({ width: 16, height: 8, fit: 'fill' })
405
+
* .toBuffer();
406
+
* const resizeThenRotate = await sharp(input)
407
+
* .resize({ width: 16, height: 8, fit: 'fill' })
408
+
* .rotate(90)
409
+
* .toBuffer();
410
+
*
411
+
* @param {number} [angle=auto] angle of rotation.
412
+
* @param {Object} [options] - if present, is an Object with optional attributes.
413
+
* @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.
414
+
* @returns {Sharp}
380
415
* @throws {Error} Invalid parameters
381
-
* @returns A sharp instance that can be used to chain operations
0 commit comments