diff --git a/docs/api-channel.md b/docs/api-channel.md index 892b2bdfd..a19ec4545 100644 --- a/docs/api-channel.md +++ b/docs/api-channel.md @@ -4,6 +4,8 @@ Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel. +See also [flatten][1]. + ### Examples ```javascript @@ -25,7 +27,7 @@ This is a no-op if the image already has an alpha channel. ### Parameters -* `alpha` **[number][1]** alpha transparency level (0=fully-transparent, 1=fully-opaque) (optional, default `1`) +* `alpha` **[number][2]** alpha transparency level (0=fully-transparent, 1=fully-opaque) (optional, default `1`) ### Examples @@ -43,7 +45,7 @@ const rgba = await sharp(rgb) .toBuffer(); ``` -* Throws **[Error][2]** Invalid alpha transparency level +* Throws **[Error][3]** Invalid alpha transparency level Returns **Sharp** @@ -57,7 +59,7 @@ Extract a single channel from a multi-channel image. ### Parameters -* `channel` **([number][1] | [string][3])** zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`. +* `channel` **([number][2] | [string][4])** zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`. ### Examples @@ -71,7 +73,7 @@ sharp(input) }); ``` -* Throws **[Error][2]** Invalid channel +* Throws **[Error][3]** Invalid channel Returns **Sharp** @@ -90,12 +92,12 @@ For raw pixel input, the `options` object should contain a `raw` attribute, whic ### Parameters -* `images` **([Array][4]<([string][3] | [Buffer][5])> | [string][3] | [Buffer][5])** one or more images (file paths, Buffers). -* `options` **[Object][6]** image options, see `sharp()` constructor. +* `images` **([Array][5]<([string][4] | [Buffer][6])> | [string][4] | [Buffer][6])** one or more images (file paths, Buffers). +* `options` **[Object][7]** image options, see `sharp()` constructor. -* Throws **[Error][2]** Invalid parameters +* Throws **[Error][3]** Invalid parameters Returns **Sharp** @@ -105,7 +107,7 @@ Perform a bitwise boolean operation on all input image channels (bands) to produ ### Parameters -* `boolOp` **[string][3]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively. +* `boolOp` **[string][4]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively. ### Examples @@ -119,18 +121,20 @@ sharp('3-channel-rgb-input.png') }); ``` -* Throws **[Error][2]** Invalid parameters +* Throws **[Error][3]** Invalid parameters Returns **Sharp** -[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +[1]: /api-operation#flatten + +[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number -[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error +[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error -[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array -[5]: https://nodejs.org/api/buffer.html +[6]: https://nodejs.org/api/buffer.html -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object diff --git a/docs/api-operation.md b/docs/api-operation.md index f6a5487d8..69a1132c1 100644 --- a/docs/api-operation.md +++ b/docs/api-operation.md @@ -176,6 +176,8 @@ Returns **Sharp** Merge alpha transparency channel, if any, with a background, then remove the alpha channel. +See also [removeAlpha][8]. + ### Parameters * `options` **[Object][2]?** @@ -186,7 +188,7 @@ Merge alpha transparency channel, if any, with a background, then remove the alp ```javascript await sharp(rgbaInput) - .flatten({background: '#F0A703' }) + .flatten({ background: '#F0A703' }) .toBuffer(); ``` @@ -245,11 +247,10 @@ Returns **Sharp** ## clahe -Perform contrast limiting adaptive histogram equalization (CLAHE) +Perform contrast limiting adaptive histogram equalization +({@link [https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE|CLAHE}][9]). -This will, in general, enhance the clarity of the image by bringing out -darker details. Please read more about CLAHE here: -[https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE][8] +This will, in general, enhance the clarity of the image by bringing out darker details. ### Parameters @@ -332,7 +333,7 @@ the selected bitwise boolean `operation` between the corresponding pixels of the ### Parameters -* `operand` **([Buffer][9] | [string][3])** Buffer containing image data or string containing the path to an image file. +* `operand` **([Buffer][10] | [string][3])** Buffer containing image data or string containing the path to an image file. * `operator` **[string][3]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively. * `options` **[Object][2]?** @@ -449,6 +450,8 @@ Returns **Sharp** [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array -[8]: https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE +[8]: /api-channel#removealpha + +[9]: https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE|CLAHE} -[9]: https://nodejs.org/api/buffer.html +[10]: https://nodejs.org/api/buffer.html diff --git a/docs/search-index.json b/docs/search-index.json index 99a72fb38..4455ec860 100644 --- a/docs/search-index.json +++ b/docs/search-index.json @@ -1 +1 @@ -[{"t":"Prerequisites","d":"Node.js v10","k":"prerequisites node","l":"/install#prerequisites"},{"t":"Prebuilt binaries","d":"Ready-compiled sharp and libvips binaries are provided for use with Node.js v10 on the most common platforms macOS x64 10.13 Linux x64 glibc 2.17, musl 1.1.24 Linux ARM64 glibc 2.2","k":"prebuilt binaries compiled sharp libvips node common platforms macos linux glibc musl arm","l":"/install#prebuilt-binaries"},{"t":"Common problems","d":"The architecture and platform of Node.js used for npm install must be the same as the architecture and platform of Node.js used at runtime. See the cross-platform","k":"common problems architecture platform node npm install runtime cross","l":"/install#common-problems"},{"t":"Apple M1","d":"Prebuilt libvips binaries are provided for macOS on ARM64 since sharp v0.28.0. During npm install sharp will be built locally, which requires Xcode and Python - see building from s","k":"apple prebuilt libvips binaries macos arm sharp during npm install built locally requires xcode python building","l":"/install#apple-m1"},{"t":"Custom libvips","d":"To use a custom, globally-installed version of libvips instead of the provided binaries, make sure it is at least the version listed under config.libvips in the package.json file a","k":"custom libvips globally installed version instead binaries make listed config package json file","l":"/install#custom-libvips"},{"t":"Building from source","d":"This module will be compiled from source at npm install time when a globally-installed libvips is detected set the SHARP_IGNORE_GLOBAL_LIBVIPS environment variable to skip this, pr","k":"building source module compiled npm install time globally installed libvips detected environment variable skip","l":"/install#building-from-source"},{"t":"Custom prebuilt binaries","d":"This is an advanced approach that most people will not require. To install the prebuilt sharp binaries from a custom URL, set the sharp_binary_host npm config option or the npm_con","k":"custom prebuilt binaries advanced approach people require install sharp url npm config option npmcon","l":"/install#custom-prebuilt-binaries"},{"t":"Chinese mirror","d":"A mirror site based in China, provided by Alibaba, contains binaries for both sharp and libvips. To use this either set the following configuration sh npm config set sharp_binary_h","k":"chinese mirror site china alibaba contains binaries sharp libvips following configuration npm config sharpbinaryh","l":"/install#chinese-mirror"},{"t":"FreeBSD","d":"The vips package must be installed before npm install is run. sh pkg install -y pkgconf vips sh cd /usr/ports/graphics/vips/ make install clean","k":"freebsd vips package installed npm install run pkg pkgconf usr ports graphics make clean","l":"/install#freebsd"},{"t":"Linux memory allocator","d":"The default memory allocator on most glibc-based Linux systems e.g. Debian, Red Hat is unsuitable for long-running, multi-threaded processes that involve lots of small memory alloc","k":"linux memory allocator glibc systems debian red hat unsuitable long running multi threaded processes small alloc","l":"/install#linux-memory-allocator"},{"t":"Heroku","d":"Add the jemalloc buildpack to reduce the effects of memory fragmentation. Set NODE_MODULES_CACHE","k":"heroku add jemalloc buildpack reduce effects memory fragmentation","l":"/install#heroku"},{"t":"AWS Lambda","d":"The binaries in the node_modules directory of the deployment package must be for the Linux x64 platform. When building your deployment package on machines other than Linux x64 glib","k":"aws lambda binaries nodemodules directory deployment package linux platform building your machines other than glib","l":"/install#aws-lambda"},{"t":"Webpack","d":"Ensure sharp is added to the externals configuration. js externals sharp commonjs sharp","k":"webpack sharp added externals configuration commonjs","l":"/install#webpack"},{"t":"Worker threads","d":"The main thread must call requiresharp before worker threads are created to ensure shared libraries remain loaded in memory until after all threads are complete.","k":"worker threads main thread requiresharp created shared libraries remain loaded memory complete","l":"/install#worker-threads"},{"t":"Canvas and Windows","d":"The prebuilt binaries provided by canvas for Windows depend on the unmaintained GTK 2, last updated in 2011. These conflict with the modern, up-to-date binaries provided by sharp.","k":"canvas windows prebuilt binaries depend unmaintained gtk last updated conflict modern date sharp","l":"/install#canvas-and-windows"},{"t":"Sharp","d":"Constructor factory to create an instance of sharp, to which further methods are chained. JPEG, PNG, WebP, AVIF or TIFF format image data can be streamed out from this object. When","k":"sharp constructor factory create instance further methods chained jpeg png webp avif tiff format data streamed out object failonerror sequentialread density pages page subifd level animated raw","l":"/api-constructor#sharp"},{"t":"metadata","d":"Fast access to uncached image metadata without decoding any compressed image data. A Promise is returned when callback is not provided. format Name of decoder used to decompress im","k":"metadata fast access uncached decoding compressed data promise returned callback format name decoder decompress","l":"/api-input#metadata"},{"t":"stats","d":"Access to pixel-derived image statistics for every channel in the image. A Promise is returned when callback is not provided. channels Array of channel statistics for each channel","k":"stats access pixel derived statistics channel promise returned callback channels array","l":"/api-input#stats"},{"t":"toFile","d":"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, WebP, AVIF, TIFF, DZI, and libvips V format","k":"tofile write output data file explicit format selected inferred extension jpeg png webp avif tiff dzi libvips","l":"/api-output#tofile"},{"t":"toBuffer","d":"Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF and raw pixel data output are supported. If no explicit format is set, the output format will match the input image, except GI","k":"tobuffer write output buffer jpeg png webp avif tiff raw pixel data explicit format match input except","l":"/api-output#tobuffer"},{"t":"withMetadata","d":"Include all metadata EXIF, XMP, IPTC from the input image in the output image. This will also convert to and add a web-friendly sRGB ICC profile unless a custom output profile is p","k":"withmetadata include metadata exif xmp iptc input output convert add web friendly srgb icc profile custom orientation density","l":"/api-output#withmetadata"},{"t":"toFormat","d":"Force output to a given format.","k":"toformat force output format","l":"/api-output#toformat"},{"t":"jpeg","d":"Use these JPEG options for output image.","k":"jpeg output quality progressive optimisecoding optimizecoding mozjpeg optimisescans optimizescans force","l":"/api-output#jpeg"},{"t":"png","d":"Use these PNG options for output image. By default, PNG output is full colour at 8 or 16 bits per pixel. Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pi","k":"png output full colour bits per pixel indexed input converted progressive palette quality colours colors dither force","l":"/api-output#png"},{"t":"webp","d":"Use these WebP options for output image.","k":"webp output quality alphaquality lossless nearlossless smartsubsample pageheight loop delay force","l":"/api-output#webp"},{"t":"gif","d":"Use these GIF options for output image. Requires libvips compiled with support for ImageMagick or GraphicsMagick. The prebuilt binaries do not include this - see installing a custo","k":"gif output requires libvips compiled imagemagick graphicsmagick prebuilt binaries include installing custo pageheight loop delay force","l":"/api-output#gif"},{"t":"avif","d":"Use these AVIF options for output image. Whilst it is possible to create AVIF images smaller than 16x16 pixels, most web browsers do not display these properly.","k":"avif output whilst possible create images smaller than pixels web browsers display properly quality lossless speed","l":"/api-output#avif"},{"t":"raw","d":"Force output to be raw, uncompressed, 8-bit unsigned integer unit8 pixel data. Pixel ordering is left-to-right, top-to-bottom, without padding. Channel ordering will be RGB or RGBA","k":"raw force output uncompressed bit unsigned integer unit pixel data ordering left right top bottom padding channel rgb rgba size overlap angle background depth skipblanks container layout centre center","l":"/api-output#raw"},{"t":"resize","d":"Resize image to width, height or width x height. When both a width and height are provided, the possible methods by which the image should fit these are cover default Preserving as","k":"resize width height possible methods fit cover preserving position background kernel","l":"/api-resize#resize"},{"t":"extend","d":"Extends/pads the edges of the image with the provided background colour. This operation will always occur after resizing and extraction, if any.","k":"extend extends pads edges background colour operation resizing extraction","l":"/api-resize#extend"},{"t":"extract","d":"Extract/crop a region of the image. Use extract before resize for pre-resize extraction. Use extract after resize for post-resize extraction. Use extract before and after for both.","k":"extract crop region resize pre extraction post left top width height","l":"/api-resize#extract"},{"t":"trim","d":"Trim boring pixels from all edges that contain values similar to the top-left pixel. Images consisting entirely of a single colour will calculate boring using the alpha channel, if","k":"trim boring pixels edges contain similar top left pixel images consisting entirely single colour calculate alpha channel","l":"/api-resize#trim"},{"t":"composite","d":"Composite images over the processed resized, extracted etc. image. The images to composite must be the same size or smaller than the processed image. If both top and left options a","k":"composite images processed resized extracted size smaller than top left","l":"/api-composite#composite"},{"t":"rotate","d":"Rotate the output image by either an explicit angle or auto-orient based on the EXIF Orientation tag. If an angle is provided, it is converted to a valid positive degree rotation.","k":"rotate output explicit angle auto orient exif orientation tag converted valid positive degree rotation background","l":"/api-operation#rotate"},{"t":"flip","d":"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 Orientation tag, if any.","k":"flip vertical axis rotation implies removal exif orientation tag","l":"/api-operation#flip"},{"t":"affine","d":"Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any. You must provide an array of length 4 or a 2x2 affine tra","k":"affine transform operation resizing extraction rotation array length tra background","l":"/api-operation#affine"},{"t":"sharpen","d":"Sharpen the image. When used without parameters, performs a fast, mild sharpen of the output image. When a sigma is provided, performs a slower, more accurate sharpen of the L chan","k":"sharpen parameters fast mild output sigma slower accurate chan","l":"/api-operation#sharpen"},{"t":"blur","d":"Blur the image. When used without parameters, performs a fast, mild blur of the output image. When a sigma is provided, performs a slower, more accurate Gaussian blur.","k":"blur parameters fast mild output sigma slower accurate gaussian","l":"/api-operation#blur"},{"t":"gamma","d":"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 a factor of gamma. This can improve","k":"gamma apply correction reducing encoding darken pre resize factor then increasing brighten post improve","l":"/api-operation#gamma"},{"t":"normalise","d":"Enhance output image contrast by stretching its luminance to cover the full dynamic range.","k":"normalise enhance output contrast stretching luminance cover full dynamic range","l":"/api-operation#normalise"},{"t":"clahe","d":"Perform contrast limiting adaptive histogram equalization CLAHE This will, in general, enhance the clarity of the image by bringing out darker details. Please read more about CLAHE","k":"clahe contrast limiting adaptive histogram equalization general enhance clarity bringing out darker details please read width height maxslope","l":"/api-operation#clahe"},{"t":"threshold","d":"Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.","k":"threshold pixel greater than equal otherwise greyscale grayscale","l":"/api-operation#threshold"},{"t":"linear","d":"Apply the linear formula a input b to the image levels adjustment","k":"linear apply formula input levels adjustment","l":"/api-operation#linear"},{"t":"modulate","d":"Transforms the image using brightness, saturation and hue rotation.","k":"modulate transforms brightness saturation hue rotation","l":"/api-operation#modulate"},{"t":"removeAlpha","d":"Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.","k":"removealpha remove alpha channel","l":"/api-channel#removealpha"},{"t":"extractChannel","d":"Extract a single channel from a multi-channel image.","k":"extractchannel extract single channel multi","l":"/api-channel#extractchannel"},{"t":"joinChannel","d":"Join one or more channels to the image. The meaning of the added channels depends on the output colourspace, set with toColourspace. By default the output image will be web-friendl","k":"joinchannel join one channels meaning added depends output colourspace tocolourspace web friendl","l":"/api-channel#joinchannel"},{"t":"tint","d":"Tint the image using the provided chroma while preserving the image luminance. An alpha channel may be present and will be unchanged by the operation.","k":"tint chroma preserving luminance alpha channel present unchanged operation","l":"/api-colour#tint"},{"t":"grayscale","d":"Alternative spelling of greyscale.","k":"grayscale greyscale","l":"/api-colour#grayscale"},{"t":"toColorspace","d":"Alternative spelling of toColourspace.","k":"tocolorspace tocolourspace","l":"/api-colour#tocolorspace"},{"t":"format","d":"An Object containing nested boolean values representing the available input and output formats/methods.","k":"format object nested boolean representing available input output formats methods memory files items","l":"/api-utility#format"},{"t":"concurrency","d":"Gets or, when a concurrency is provided, sets the number of threads libvips should create to process each image. The default value is the number of CPU cores, except when using gli","k":"concurrency number threads libvips create process cpu cores except gli","l":"/api-utility#concurrency"},{"t":"queue","d":"An EventEmitter that emits a change event when a task is either queued, waiting for libuv to provide a worker thread complete","k":"queue eventemitter emits change event task queued waiting libuv worker thread complete","l":"/api-utility#queue"}] \ No newline at end of file +[{"t":"Prerequisites","d":"Node.js v10","k":"prerequisites node","l":"/install#prerequisites"},{"t":"Prebuilt binaries","d":"Ready-compiled sharp and libvips binaries are provided for use with Node.js v10 on the most common platforms macOS x64 10.13 Linux x64 glibc 2.17, musl 1.1.24 Linux ARM64 glibc 2.2","k":"prebuilt binaries compiled sharp libvips node common platforms macos linux glibc musl arm","l":"/install#prebuilt-binaries"},{"t":"Common problems","d":"The architecture and platform of Node.js used for npm install must be the same as the architecture and platform of Node.js used at runtime. See the cross-platform","k":"common problems architecture platform node npm install runtime cross","l":"/install#common-problems"},{"t":"Apple M1","d":"Prebuilt libvips binaries are provided for macOS on ARM64 since sharp v0.28.0. During npm install sharp will be built locally, which requires Xcode and Python - see building from s","k":"apple prebuilt libvips binaries macos arm sharp during npm install built locally requires xcode python building","l":"/install#apple-m1"},{"t":"Custom libvips","d":"To use a custom, globally-installed version of libvips instead of the provided binaries, make sure it is at least the version listed under config.libvips in the package.json file a","k":"custom libvips globally installed version instead binaries make listed config package json file","l":"/install#custom-libvips"},{"t":"Building from source","d":"This module will be compiled from source at npm install time when a globally-installed libvips is detected set the SHARP_IGNORE_GLOBAL_LIBVIPS environment variable to skip this, pr","k":"building source module compiled npm install time globally installed libvips detected environment variable skip","l":"/install#building-from-source"},{"t":"Custom prebuilt binaries","d":"This is an advanced approach that most people will not require. To install the prebuilt sharp binaries from a custom URL, set the sharp_binary_host npm config option or the npm_con","k":"custom prebuilt binaries advanced approach people require install sharp url npm config option npmcon","l":"/install#custom-prebuilt-binaries"},{"t":"Chinese mirror","d":"A mirror site based in China, provided by Alibaba, contains binaries for both sharp and libvips. To use this either set the following configuration sh npm config set sharp_binary_h","k":"chinese mirror site china alibaba contains binaries sharp libvips following configuration npm config sharpbinaryh","l":"/install#chinese-mirror"},{"t":"FreeBSD","d":"The vips package must be installed before npm install is run. sh pkg install -y pkgconf vips sh cd /usr/ports/graphics/vips/ make install clean","k":"freebsd vips package installed npm install run pkg pkgconf usr ports graphics make clean","l":"/install#freebsd"},{"t":"Linux memory allocator","d":"The default memory allocator on most glibc-based Linux systems e.g. Debian, Red Hat is unsuitable for long-running, multi-threaded processes that involve lots of small memory alloc","k":"linux memory allocator glibc systems debian red hat unsuitable long running multi threaded processes small alloc","l":"/install#linux-memory-allocator"},{"t":"Heroku","d":"Add the jemalloc buildpack to reduce the effects of memory fragmentation. Set NODE_MODULES_CACHE","k":"heroku add jemalloc buildpack reduce effects memory fragmentation","l":"/install#heroku"},{"t":"AWS Lambda","d":"The binaries in the node_modules directory of the deployment package must be for the Linux x64 platform. When building your deployment package on machines other than Linux x64 glib","k":"aws lambda binaries nodemodules directory deployment package linux platform building your machines other than glib","l":"/install#aws-lambda"},{"t":"Webpack","d":"Ensure sharp is added to the externals configuration. js externals sharp commonjs sharp","k":"webpack sharp added externals configuration commonjs","l":"/install#webpack"},{"t":"Worker threads","d":"The main thread must call requiresharp before worker threads are created to ensure shared libraries remain loaded in memory until after all threads are complete.","k":"worker threads main thread requiresharp created shared libraries remain loaded memory complete","l":"/install#worker-threads"},{"t":"Canvas and Windows","d":"The prebuilt binaries provided by canvas for Windows depend on the unmaintained GTK 2, last updated in 2011. These conflict with the modern, up-to-date binaries provided by sharp.","k":"canvas windows prebuilt binaries depend unmaintained gtk last updated conflict modern date sharp","l":"/install#canvas-and-windows"},{"t":"Sharp","d":"Constructor factory to create an instance of sharp, to which further methods are chained. JPEG, PNG, WebP, AVIF or TIFF format image data can be streamed out from this object. When","k":"sharp constructor factory create instance further methods chained jpeg png webp avif tiff format data streamed out object failonerror sequentialread density pages page subifd level animated raw","l":"/api-constructor#sharp"},{"t":"metadata","d":"Fast access to uncached image metadata without decoding any compressed image data. A Promise is returned when callback is not provided. format Name of decoder used to decompress im","k":"metadata fast access uncached decoding compressed data promise returned callback format name decoder decompress","l":"/api-input#metadata"},{"t":"stats","d":"Access to pixel-derived image statistics for every channel in the image. A Promise is returned when callback is not provided. channels Array of channel statistics for each channel","k":"stats access pixel derived statistics channel promise returned callback channels array","l":"/api-input#stats"},{"t":"toFile","d":"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, WebP, AVIF, TIFF, DZI, and libvips V format","k":"tofile write output data file explicit format selected inferred extension jpeg png webp avif tiff dzi libvips","l":"/api-output#tofile"},{"t":"toBuffer","d":"Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF and raw pixel data output are supported. If no explicit format is set, the output format will match the input image, except GI","k":"tobuffer write output buffer jpeg png webp avif tiff raw pixel data explicit format match input except","l":"/api-output#tobuffer"},{"t":"withMetadata","d":"Include all metadata EXIF, XMP, IPTC from the input image in the output image. This will also convert to and add a web-friendly sRGB ICC profile unless a custom output profile is p","k":"withmetadata include metadata exif xmp iptc input output convert add web friendly srgb icc profile custom orientation density","l":"/api-output#withmetadata"},{"t":"toFormat","d":"Force output to a given format.","k":"toformat force output format","l":"/api-output#toformat"},{"t":"jpeg","d":"Use these JPEG options for output image.","k":"jpeg output quality progressive optimisecoding optimizecoding mozjpeg optimisescans optimizescans force","l":"/api-output#jpeg"},{"t":"png","d":"Use these PNG options for output image. By default, PNG output is full colour at 8 or 16 bits per pixel. Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pi","k":"png output full colour bits per pixel indexed input converted progressive palette quality colours colors dither force","l":"/api-output#png"},{"t":"webp","d":"Use these WebP options for output image.","k":"webp output quality alphaquality lossless nearlossless smartsubsample pageheight loop delay force","l":"/api-output#webp"},{"t":"gif","d":"Use these GIF options for output image. Requires libvips compiled with support for ImageMagick or GraphicsMagick. The prebuilt binaries do not include this - see installing a custo","k":"gif output requires libvips compiled imagemagick graphicsmagick prebuilt binaries include installing custo pageheight loop delay force","l":"/api-output#gif"},{"t":"avif","d":"Use these AVIF options for output image. Whilst it is possible to create AVIF images smaller than 16x16 pixels, most web browsers do not display these properly.","k":"avif output whilst possible create images smaller than pixels web browsers display properly quality lossless speed","l":"/api-output#avif"},{"t":"raw","d":"Force output to be raw, uncompressed, 8-bit unsigned integer unit8 pixel data. Pixel ordering is left-to-right, top-to-bottom, without padding. Channel ordering will be RGB or RGBA","k":"raw force output uncompressed bit unsigned integer unit pixel data ordering left right top bottom padding channel rgb rgba size overlap angle background depth skipblanks container layout centre center","l":"/api-output#raw"},{"t":"resize","d":"Resize image to width, height or width x height. When both a width and height are provided, the possible methods by which the image should fit these are cover default Preserving as","k":"resize width height possible methods fit cover preserving position background kernel","l":"/api-resize#resize"},{"t":"extend","d":"Extends/pads the edges of the image with the provided background colour. This operation will always occur after resizing and extraction, if any.","k":"extend extends pads edges background colour operation resizing extraction","l":"/api-resize#extend"},{"t":"extract","d":"Extract/crop a region of the image. Use extract before resize for pre-resize extraction. Use extract after resize for post-resize extraction. Use extract before and after for both.","k":"extract crop region resize pre extraction post left top width height","l":"/api-resize#extract"},{"t":"trim","d":"Trim boring pixels from all edges that contain values similar to the top-left pixel. Images consisting entirely of a single colour will calculate boring using the alpha channel, if","k":"trim boring pixels edges contain similar top left pixel images consisting entirely single colour calculate alpha channel","l":"/api-resize#trim"},{"t":"composite","d":"Composite images over the processed resized, extracted etc. image. The images to composite must be the same size or smaller than the processed image. If both top and left options a","k":"composite images processed resized extracted size smaller than top left","l":"/api-composite#composite"},{"t":"rotate","d":"Rotate the output image by either an explicit angle or auto-orient based on the EXIF Orientation tag. If an angle is provided, it is converted to a valid positive degree rotation.","k":"rotate output explicit angle auto orient exif orientation tag converted valid positive degree rotation background","l":"/api-operation#rotate"},{"t":"flip","d":"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 Orientation tag, if any.","k":"flip vertical axis rotation implies removal exif orientation tag","l":"/api-operation#flip"},{"t":"affine","d":"Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any. You must provide an array of length 4 or a 2x2 affine tra","k":"affine transform operation resizing extraction rotation array length tra background","l":"/api-operation#affine"},{"t":"sharpen","d":"Sharpen the image. When used without parameters, performs a fast, mild sharpen of the output image. When a sigma is provided, performs a slower, more accurate sharpen of the L chan","k":"sharpen parameters fast mild output sigma slower accurate chan","l":"/api-operation#sharpen"},{"t":"blur","d":"Blur the image. When used without parameters, performs a fast, mild blur of the output image. When a sigma is provided, performs a slower, more accurate Gaussian blur.","k":"blur parameters fast mild output sigma slower accurate gaussian","l":"/api-operation#blur"},{"t":"gamma","d":"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 a factor of gamma. This can improve","k":"gamma apply correction reducing encoding darken pre resize factor then increasing brighten post improve","l":"/api-operation#gamma"},{"t":"normalise","d":"Enhance output image contrast by stretching its luminance to cover the full dynamic range.","k":"normalise enhance output contrast stretching luminance cover full dynamic range","l":"/api-operation#normalise"},{"t":"clahe","d":"Perform contrast limiting adaptive histogram equalization link https//en.wikipedia.org/wiki/Adaptive_histogram_equalizationContrast_Limited_AHECLAHE9. This will, in general, enhanc","k":"clahe contrast limiting adaptive histogram equalization link https wikipedia org wiki general enhanc width height maxslope","l":"/api-operation#clahe"},{"t":"threshold","d":"Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.","k":"threshold pixel greater than equal otherwise greyscale grayscale","l":"/api-operation#threshold"},{"t":"linear","d":"Apply the linear formula a input b to the image levels adjustment","k":"linear apply formula input levels adjustment","l":"/api-operation#linear"},{"t":"modulate","d":"Transforms the image using brightness, saturation and hue rotation.","k":"modulate transforms brightness saturation hue rotation","l":"/api-operation#modulate"},{"t":"removeAlpha","d":"Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel. See also flatten1.","k":"removealpha remove alpha channel flatten","l":"/api-channel#removealpha"},{"t":"extractChannel","d":"Extract a single channel from a multi-channel image.","k":"extractchannel extract single channel multi","l":"/api-channel#extractchannel"},{"t":"joinChannel","d":"Join one or more channels to the image. The meaning of the added channels depends on the output colourspace, set with toColourspace. By default the output image will be web-friendl","k":"joinchannel join one channels meaning added depends output colourspace tocolourspace web friendl","l":"/api-channel#joinchannel"},{"t":"tint","d":"Tint the image using the provided chroma while preserving the image luminance. An alpha channel may be present and will be unchanged by the operation.","k":"tint chroma preserving luminance alpha channel present unchanged operation","l":"/api-colour#tint"},{"t":"grayscale","d":"Alternative spelling of greyscale.","k":"grayscale greyscale","l":"/api-colour#grayscale"},{"t":"toColorspace","d":"Alternative spelling of toColourspace.","k":"tocolorspace tocolourspace","l":"/api-colour#tocolorspace"},{"t":"format","d":"An Object containing nested boolean values representing the available input and output formats/methods.","k":"format object nested boolean representing available input output formats methods memory files items","l":"/api-utility#format"},{"t":"concurrency","d":"Gets or, when a concurrency is provided, sets the number of threads libvips should create to process each image. The default value is the number of CPU cores, except when using gli","k":"concurrency number threads libvips create process cpu cores except gli","l":"/api-utility#concurrency"},{"t":"queue","d":"An EventEmitter that emits a change event when a task is either queued, waiting for libuv to provide a worker thread complete","k":"queue eventemitter emits change event task queued waiting libuv worker thread complete","l":"/api-utility#queue"}] \ No newline at end of file diff --git a/lib/channel.js b/lib/channel.js index 79fcc6389..a500d9a9e 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -15,6 +15,8 @@ const bool = { /** * Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel. * + * See also {@link /api-operation#flatten|flatten}. + * * @example * sharp('rgba.png') * .removeAlpha() diff --git a/lib/operation.js b/lib/operation.js index aafc52a4f..1c9ce1bcb 100644 --- a/lib/operation.js +++ b/lib/operation.js @@ -270,9 +270,11 @@ function blur (sigma) { /** * Merge alpha transparency channel, if any, with a background, then remove the alpha channel. * + * See also {@link /api-channel#removealpha|removeAlpha}. + * * @example * await sharp(rgbaInput) - * .flatten({background: '#F0A703' }) + * .flatten({ background: '#F0A703' }) * .toBuffer(); * * @param {Object} [options] @@ -351,11 +353,10 @@ function normalize (normalize) { } /** - * Perform contrast limiting adaptive histogram equalization (CLAHE) + * Perform contrast limiting adaptive histogram equalization + * ({@link https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE|CLAHE}). * - * This will, in general, enhance the clarity of the image by bringing out - * darker details. Please read more about CLAHE here: - * https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE + * This will, in general, enhance the clarity of the image by bringing out darker details. * * @since 0.28.3 *