Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/lovell/sharp
/ functions
Functions
222 in github.com/lovell/sharp
⨍
Functions
222
◇
Types & classes
67
↓ 644 callers
Method
toBuffer
* Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported. * By default, the format will match the input imag
lib/index.d.ts:661
↓ 497 callers
Method
resize
* Resize image to width, height or width x height. * * When both a width and height are provided, the possible methods by which the
lib/index.d.ts:925
↓ 175 callers
Method
metadata
* Fast access to (uncached) image metadata without decoding any compressed image data. * @returns A sharp instance that can be used to chain
lib/index.d.ts:326
↓ 132 callers
Function
isInAcceptableRange
(actual, expected)
test/unit/stats.js:14
↓ 111 callers
Function
isInRange
(actual, min, max)
test/unit/stats.js:17
↓ 108 callers
Function
isInteger
(val)
test/unit/stats.js:20
↓ 105 callers
Method
toFile
* Write output image data to a file. * If an explicit output format is not selected, it will be inferred from the extension, with JPEG, PNG,
lib/index.d.ts:645
↓ 99 callers
Function
getPath
(filename)
test/fixtures/index.js:13
↓ 74 callers
Method
png
* Use these PNG options for output image. * PNG output is always full colour at 8 or 16 bits per pixel. * Indexed PNG input at 1, 2
lib/index.d.ts:794
↓ 65 callers
Method
jpeg
* Use these JPEG options for output image. * @param options Output options. * @throws {Error} Invalid options * @returns A
lib/index.d.ts:764
↓ 58 callers
Method
tiff
* Use these TIFF options for output image. * @param options Output options. * @throws {Error} Invalid options * @returns A
lib/index.d.ts:836
↓ 57 callers
Method
rotate
* Rotate the output image by either an explicit angle * or auto-orient based on the EXIF `Orientation` tag. * * If an angle
lib/index.d.ts:407
↓ 54 callers
Method
raw
* Force output to be raw, uncompressed uint8 pixel data. * @param options Raw output options. * @throws {Error} Invalid options
lib/index.d.ts:844
↓ 51 callers
Method
webp
* Use these WebP options for output image. * @param options Output options. * @throws {Error} Invalid options * @returns A
lib/index.d.ts:802
↓ 49 callers
Method
extract
* Extract a region of the image. * - Use extract() before resize() for pre-resize extraction. * - Use extract() after resize() for
lib/index.d.ts:956
↓ 48 callers
Method
tile
* Use tile-based deep zoom (image pyramid) output. * Set the format and options for tile images via the toFormat, jpeg, png or webp functions
lib/index.d.ts:877
↓ 40 callers
Method
composite
* Composite image(s) over the processed (resized, extracted etc.) image. * * The images to composite must be the same size or smalle
lib/index.d.ts:308
↓ 39 callers
Method
gif
* Use these GIF options for output image. * Requires libvips compiled with support for ImageMagick or GraphicsMagick. The prebuilt binaries d
lib/index.d.ts:811
↓ 36 callers
Function
collect
(metadata, spec)
test/unit/metadata.js:17
↓ 35 callers
Method
toColourspace
* Set the output colourspace. * By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
lib/index.d.ts:285
↓ 33 callers
Method
stats
* Access to pixel-derived image statistics for every channel in the image. * @returns A sharp instance that can be used to chain operations
lib/index.d.ts:344
↓ 31 callers
Function
bufferWithInfo
(image)
test/unit/rotate.js:11
↓ 29 callers
Method
extend
* Extend / pad / extrude one or more edges of the image with either * the provided background colour or pixels derived from the image.
lib/index.d.ts:944
↓ 27 callers
Method
withMetadata
* Include all metadata (EXIF, XMP, IPTC) from the input image in the output image. * The default behaviour, when withMetadata is not used, is
lib/index.d.ts:756
↓ 26 callers
Method
trim
* Trim pixels from all edges that contain values similar to the given background colour, which defaults to that of the top-left pixel. * Imag
lib/index.d.ts:966
↓ 25 callers
Method
affine
* Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any. * You must provi
lib/index.d.ts:460
↓ 23 callers
Method
clahe
* Perform contrast limiting adaptive histogram equalization (CLAHE) * * This will, in general, enhance the clarity of the image by b
lib/index.d.ts:572
↓ 21 callers
Method
blur
* Blur the image. * When used without parameters, performs a fast, mild blur of the output image. * When a sigma is provided, perfor
lib/index.d.ts:490
↓ 20 callers
Method
joinChannel
* Join one or more channels to the image. The meaning of the added channels depends on the output colourspace, set with toColourspace(). * By
lib/index.d.ts:218
↓ 20 callers
Method
toFormat
* Force output to a given format. * @param format a String or an Object with an 'id' attribute * @param options output options
lib/index.d.ts:853
↓ 19 callers
Method
heif
* Use these HEIF options for output image. * Support for patent-encumbered HEIC images requires the use of a globally-installed libvips compi
lib/index.d.ts:828
↓ 18 callers
Method
negate
* Produce the "negative" of the image. * @param negate true to enable and false to disable, or an object of options (defaults to true)
lib/index.d.ts:539
↓ 18 callers
Method
sharpen
* Sharpen the image. * When used without parameters, performs a fast, mild sharpen of the output image. * When a sigma is provided,
lib/index.d.ts:471
↓ 17 callers
Method
jxl
* Use these JPEG-XL (JXL) options for output image. * This feature is experimental, please do not use in production systems. * Requi
lib/index.d.ts:784
↓ 16 callers
Function
expectSimilar
(t, expectedImage, actualImage)
test/unit/rotate.js:12
↓ 16 callers
Method
linear
* Apply the linear formula a * input + b to the image (levels adjustment) * @param a multiplier (optional, default 1.0) * @param b o
lib/index.d.ts:609
↓ 15 callers
Method
avif
* Use these AVIF options for output image. * @param options Output options. * @throws {Error} Invalid options * @returns A
lib/index.d.ts:819
↓ 14 callers
Method
normalise
* Enhance output image contrast by stretching its luminance to cover a full dynamic range. * * Uses a histogram-based approach, taki
lib/index.d.ts:553
↓ 14 callers
Method
threshold
* Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0. * @param threshold a value
lib/index.d.ts:589
↓ 13 callers
Method
recomb
* Recomb the image with the specified matrix. * @param inputMatrix 3x3 Recombination matrix or 4x4 Recombination matrix * @throws {E
lib/index.d.ts:617
↓ 12 callers
Method
withIccProfile
* Transform using an ICC profile and attach to the output image. * @param {string} icc - Absolute filesystem path to output ICC profile or bu
lib/index.d.ts:733
↓ 11 callers
Method
extractChannel
* Extract a single channel from a multi-channel image. * @param channel zero-indexed channel/band number to extract, or red, green, blue or a
lib/index.d.ts:203
↓ 11 callers
Method
modulate
* Transforms the image using brightness, saturation, hue rotation and lightness. * Brightness and lightness both operate on luminance, with t
lib/index.d.ts:625
↓ 10 callers
Function
assertDeepZoomTiles
(t, directory, expectedSize, expectedLevels)
test/unit/tile.js:26
↓ 10 callers
Function
countDeepZoomAssertions
(directory)
test/unit/tile.js:15
↓ 10 callers
Method
tint
* Tint the image using the provided colour. * An alpha channel may be present and will be unchanged by the operation. * @param tint
lib/index.d.ts:238
↓ 10 callers
Method
withXmp
* Set XMP metadata in the output image. * @param {string} xmp - String containing XMP metadata to be embedded in the output image. *
lib/index.d.ts:747
↓ 9 callers
Function
buildPlatformArch
()
lib/libvips.mjs:43
↓ 9 callers
Method
convolve
* Convolve the image with the specified kernel. * @param kernel the specified kernel * @throws {Error} Invalid parameters *
lib/index.d.ts:580
↓ 9 callers
Method
flatten
* Merge alpha transparency channel, if any, with background. * @param flatten true to enable and false to disable (defaults to true)
lib/index.d.ts:513
↓ 9 callers
Method
gamma
* Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of 1/gamma then increasing the encoding (brighten) post-resize at
lib/index.d.ts:532
↓ 8 callers
Method
greyscale
* Convert to 8-bit greyscale; 256 shades of grey. * This is a linear operation. * If the input image is in a non-linear colour space
lib/index.d.ts:250
↓ 7 callers
Function
assertGoogleTiles
(t, directory, expectedLevels, extension = 'jpg')
test/unit/tile.js:74
↓ 7 callers
Method
autoOrient
* Alias for calling `rotate()` with no arguments, which orients the image based * on EXIF orientsion. * * This operation is
lib/index.d.ts:421
↓ 7 callers
Method
flip
* Flip the image about the vertical Y axis. This always occurs after rotation, if any. * The use of flip implies the removal of the EXIF Orie
lib/index.d.ts:429
↓ 7 callers
Function
log
(item)
lib/libvips.mjs:29
↓ 7 callers
Method
pipelineColourspace
* Set the pipeline colourspace. * The input image will be converted to the provided colourspace at the start of the pipeline. * All
lib/index.d.ts:268
↓ 6 callers
Method
boolean
* Perform a bitwise boolean operation with operand image. * This operation creates an output image where each pixel is the result of the sele
lib/index.d.ts:600
↓ 6 callers
Method
clone
* Take a "snapshot" of the Sharp instance, returning a new instance. * Cloned instances inherit the input of their parent instance.
lib/index.d.ts:320
↓ 6 callers
Function
inRange
(val, min, max)
lib/is.mjs:93
↓ 6 callers
Method
keepIccProfile
* Keep ICC profile from the input image in the output image where possible. * @returns A sharp instance that can be used to chain operations
lib/index.d.ts:725
↓ 6 callers
Function
randomDimension
()
test/bench/random.js:19
↓ 5 callers
Function
assertNormalized
(t, data)
test/unit/normalize.js:11
↓ 5 callers
Function
assertZoomifyTiles
(t, directory, expectedLevels)
test/unit/tile.js:58
↓ 5 callers
Function
countZoomifyAssertions
(directory)
test/unit/tile.js:53
↓ 5 callers
Method
flop
* Flop the image about the horizontal X axis. This always occurs after rotation, if any. * The use of flop implies the removal of the EXIF Or
lib/index.d.ts:437
↓ 5 callers
Method
jp2
* Use these JP2 (JPEG 2000) options for output image. * @param options Output options. * @throws {Error} Invalid options *
lib/index.d.ts:772
↓ 5 callers
Method
normalize
* Alternative spelling of normalise. * @param normalize options * @throws {Error} Invalid parameters * @returns A sharp ins
lib/index.d.ts:561
↓ 5 callers
Method
withExif
* Set EXIF metadata in the output image, ignoring any EXIF in the input image. * @param {Exif} exif Object keyed by IFD0, IFD1 etc. of key/va
lib/index.d.ts:711
↓ 4 callers
Method
bandbool
* Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image. * @param boolOp one of "a
lib/index.d.ts:226
↓ 4 callers
Method
dilate
* Expand foreground objects using the dilate morphological operator. * @param {Number} [width=1] dilation width in pixels. * @throws
lib/index.d.ts:498
↓ 4 callers
Method
erode
* Shrink foreground objects using the erode morphological operator. * @param {Number} [width=1] erosion width in pixels. * @throws {
lib/index.d.ts:506
↓ 4 callers
Function
isResizeExpected
* @private
lib/resize.mjs:116
↓ 4 callers
Method
median
* Apply median filter. When used without parameters the default window is 3x3. * @param size square mask size: size x size (optional, default
lib/index.d.ts:479
↓ 4 callers
Method
timeout
* Set a timeout for processing, in seconds. Use a value of zero to continue processing indefinitely, the default behaviour. * The clock start
lib/index.d.ts:886
↓ 4 callers
Method
withDensity
* Set output density (DPI) in EXIF metadata. * @param density Density in dots per inch (DPI). * @returns A sharp instance that can b
lib/index.d.ts:696
↓ 3 callers
Method
ensureAlpha
* Ensure alpha channel, if missing. The added alpha channel will be fully opaque. This is a no-op if the image already has an alpha channel.
lib/index.d.ts:195
↓ 3 callers
Function
isRotationExpected
* @private
lib/resize.mjs:109
↓ 3 callers
Method
keepExif
* Keep all EXIF metadata from the input image in the output image. * EXIF metadata is unsupported for TIFF output. * @returns A shar
lib/index.d.ts:703
↓ 3 callers
Function
setPlatform
(platform)
test/unit/libvips.js:14
↓ 3 callers
Function
skipSearch
(status, reason, logger)
lib/libvips.mjs:174
↓ 3 callers
Method
toColorspace
* Alternative spelling of toColourspace(). * @param colorspace output colorspace e.g. srgb, rgb, cmyk, lab, b-w ... * @throws {Error
lib/index.d.ts:293
↓ 3 callers
Method
toUint8Array
* Write output to a Uint8Array backed by a transferable ArrayBuffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported. * By defa
lib/index.d.ts:688
↓ 3 callers
Function
trySetAnimationOptions
* Set animation options if available. * @private * * @param {Object} [source] - output options * @param {number} [source.loop=0] - number of anima
lib/output.mjs:1055
↓ 3 callers
Method
unflatten
* Ensure the image has an alpha channel with all white pixel values made fully transparent. * Existing alpha channel values for non-white pix
lib/index.d.ts:520
↓ 2 callers
Function
bitdepthFromColourCount
(colours)
lib/output.mjs:36
↓ 2 callers
Function
errJp2Save
()
lib/output.mjs:34
↓ 2 callers
Function
fingerprint
(image)
test/fixtures/index.js:17
↓ 2 callers
Function
globalLibvipsVersion
()
lib/libvips.mjs:125
↓ 2 callers
Function
isEmscripten
()
lib/libvips.mjs:89
↓ 2 callers
Function
isUnsupportedNodeRuntime
()
lib/libvips.mjs:81
↓ 2 callers
Method
keepMetadata
* Keep all metadata (EXIF, ICC, XMP, IPTC) from the input image in the output image. * @returns A sharp instance that can be used to chain op
lib/index.d.ts:338
↓ 2 callers
Function
runtimeLibc
()
lib/libvips.mjs:39
↓ 2 callers
Function
safeRequire
(name)
test/bench/perf.js:12
↓ 2 callers
Function
sha512
(s)
lib/libvips.mjs:104
↓ 2 callers
Method
withExifMerge
* Update EXIF metadata from the input image in the output image. * @param {Exif} exif Object keyed by IFD0, IFD1 etc. of key/value string pai
lib/index.d.ts:719
↓ 1 callers
Function
_getBackgroundColourOption
* Create a RGBA colour array from a given value. * @private * @param {string|Object} value * @throws {Error} Invalid value
lib/colour.mjs:143
↓ 1 callers
Function
_inputOptionsFromObject
* Extract input options, if any, from an object. * @private
lib/input.mjs:40
↓ 1 callers
Function
assertTileOverlap
(t, directory, tileSize)
test/unit/tile.js:92
↓ 1 callers
Function
cache
* Gets or, when options are provided, sets the limits of _libvips'_ operation cache. * Existing entries in the cache will be trimmed after any change
lib/utility.mjs:108
next →
1–100 of 222, ranked by callers