Docs: clarify that metadata is based on input, not output

This commit is contained in:
Lovell Fuller
2021-12-12 20:38:23 +00:00
parent dd6583044b
commit 2b8e4d20de
3 changed files with 18 additions and 3 deletions

View File

@@ -290,7 +290,11 @@ function _isStreamInput () {
}
/**
* Fast access to (uncached) image metadata without decoding any compressed image data.
* Fast access to (uncached) image metadata without decoding any compressed pixel data.
*
* This is taken from the header of the input image.
* It does not include operations, such as resize, to be applied to the output image.
*
* A `Promise` is returned when `callback` is not provided.
*
* - `format`: Name of decoder used to decompress image data e.g. `jpeg`, `png`, `webp`, `gif`, `svg`
@@ -322,6 +326,9 @@ function _isStreamInput () {
* - `tifftagPhotoshop`: Buffer containing raw TIFFTAG_PHOTOSHOP data, if present
*
* @example
* const metadata = await sharp(input).metadata();
*
* @example
* const image = sharp(inputJpg);
* image
* .metadata()