1
1
## rotate
2
+ > rotate([ angle] , [ options] ) ⇒ <code >Sharp</code >
3
+
2
4
Rotate the output image by either an explicit angle
3
5
or auto-orient based on the EXIF ` Orientation ` tag.
4
6
@@ -57,6 +59,8 @@ const resizeThenRotate = await sharp(input)
57
59
58
60
59
61
## flip
62
+ > flip([ flip] ) ⇒ <code >Sharp</code >
63
+
60
64
Mirror the image vertically (up-down) about the x-axis.
61
65
This always occurs before rotation, if any.
62
66
@@ -75,6 +79,8 @@ const output = await sharp(input).flip().toBuffer();
75
79
76
80
77
81
## flop
82
+ > flop([ flop] ) ⇒ <code >Sharp</code >
83
+
78
84
Mirror the image horizontally (left-right) about the y-axis.
79
85
This always occurs before rotation, if any.
80
86
@@ -91,6 +97,8 @@ const output = await sharp(input).flop().toBuffer();
91
97
92
98
93
99
## affine
100
+ > affine(matrix, [ options] ) ⇒ <code >Sharp</code >
101
+
94
102
Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
95
103
96
104
You must provide an array of length 4 or a 2x2 affine transformation matrix.
@@ -142,6 +150,8 @@ inputStream
142
150
143
151
144
152
## sharpen
153
+ > sharpen([ options] , [ flat] , [ jagged] ) ⇒ <code >Sharp</code >
154
+
145
155
Sharpen the image.
146
156
147
157
When used without parameters, performs a fast, mild sharpen of the output image.
@@ -193,6 +203,8 @@ const data = await sharp(input)
193
203
194
204
195
205
## median
206
+ > median([ size] ) ⇒ <code >Sharp</code >
207
+
196
208
Apply median filter.
197
209
When used without parameters the default window is 3x3.
198
210
@@ -217,6 +229,8 @@ const output = await sharp(input).median(5).toBuffer();
217
229
218
230
219
231
## blur
232
+ > blur([ sigma] ) ⇒ <code >Sharp</code >
233
+
220
234
Blur the image.
221
235
222
236
When used without parameters, performs a fast 3x3 box blur (equivalent to a box linear filter).
@@ -248,6 +262,8 @@ const gaussianBlurred = await sharp(input)
248
262
249
263
250
264
## flatten
265
+ > flatten([ options] ) ⇒ <code >Sharp</code >
266
+
251
267
Merge alpha transparency channel, if any, with a background, then remove the alpha channel.
252
268
253
269
See also [ removeAlpha] ( /api-channel#removealpha ) .
@@ -268,6 +284,8 @@ await sharp(rgbaInput)
268
284
269
285
270
286
## unflatten
287
+ > unflatten()
288
+
271
289
Ensure the image has an alpha channel
272
290
with all white pixel values made fully transparent.
273
291
@@ -293,6 +311,8 @@ await sharp(rgbInput)
293
311
294
312
295
313
## gamma
314
+ > gamma([ gamma] , [ gammaOut] ) ⇒ <code >Sharp</code >
315
+
296
316
Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of ` 1/gamma `
297
317
then increasing the encoding (brighten) post-resize at a factor of ` gamma ` .
298
318
This can improve the perceived brightness of a resized image in non-linear colour spaces.
@@ -315,6 +335,8 @@ Supply a second argument to use a different output gamma value, otherwise the fi
315
335
316
336
317
337
## negate
338
+ > negate([ options] ) ⇒ <code >Sharp</code >
339
+
318
340
Produce the "negative" of the image.
319
341
320
342
@@ -339,6 +361,8 @@ const output = await sharp(input)
339
361
340
362
341
363
## normalise
364
+ > normalise([ options] ) ⇒ <code >Sharp</code >
365
+
342
366
Enhance output image contrast by stretching its luminance to cover a full dynamic range.
343
367
344
368
Uses a histogram-based approach, taking a default range of 1% to 99% to reduce sensitivity to noise at the extremes.
@@ -369,6 +393,8 @@ const output = await sharp(input)
369
393
370
394
371
395
## normalize
396
+ > normalize([ options] ) ⇒ <code >Sharp</code >
397
+
372
398
Alternative spelling of normalise.
373
399
374
400
@@ -388,6 +414,8 @@ const output = await sharp(input)
388
414
389
415
390
416
## clahe
417
+ > clahe(options) ⇒ <code >Sharp</code >
418
+
391
419
Perform contrast limiting adaptive histogram equalization
392
420
[ CLAHE] ( https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE ) .
393
421
@@ -419,6 +447,8 @@ const output = await sharp(input)
419
447
420
448
421
449
## convolve
450
+ > convolve(kernel) ⇒ <code >Sharp</code >
451
+
422
452
Convolve the image with the specified kernel.
423
453
424
454
@@ -453,6 +483,8 @@ sharp(input)
453
483
454
484
455
485
## threshold
486
+ > threshold([ threshold] , [ options] ) ⇒ <code >Sharp</code >
487
+
456
488
Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
457
489
458
490
@@ -471,6 +503,8 @@ Any pixel value greater than or equal to the threshold value will be set to 255,
471
503
472
504
473
505
## boolean
506
+ > boolean(operand, operator, [ options] ) ⇒ <code >Sharp</code >
507
+
474
508
Perform a bitwise boolean operation with operand image.
475
509
476
510
This operation creates an output image where each pixel is the result of
@@ -495,6 +529,8 @@ the selected bitwise boolean `operation` between the corresponding pixels of the
495
529
496
530
497
531
## linear
532
+ > linear([ a] , [ b] ) ⇒ <code >Sharp</code >
533
+
498
534
Apply the linear formula ` a ` * input + ` b ` to the image to adjust image levels.
499
535
500
536
When a single number is provided, it will be used for all image channels.
@@ -529,6 +565,8 @@ await sharp(rgbInput)
529
565
530
566
531
567
## recomb
568
+ > recomb(inputMatrix) ⇒ <code >Sharp</code >
569
+
532
570
Recombine the image with the specified matrix.
533
571
534
572
@@ -559,6 +597,8 @@ sharp(input)
559
597
560
598
561
599
## modulate
600
+ > modulate([ options] ) ⇒ <code >Sharp</code >
601
+
562
602
Transforms the image using brightness, saturation, hue rotation, and lightness.
563
603
Brightness and lightness both operate on luminance, with the difference being that
564
604
brightness is multiplicative whereas lightness is additive.
0 commit comments