mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Docs: ensure inclusion of jp2 function
A misplaced code coverage comment was preventing this. See ef849fd for the original commit where this broke.
This commit is contained in:
parent
d6b60a60c6
commit
afed876f90
@ -374,6 +374,48 @@ await sharp('in.gif', { animated: true })
|
|||||||
.gif({ interFrameMaxError: 8 })
|
.gif({ interFrameMaxError: 8 })
|
||||||
.toFile('optim.gif');
|
.toFile('optim.gif');
|
||||||
```
|
```
|
||||||
|
<a name="jp2"></a>
|
||||||
|
|
||||||
|
## jp
|
||||||
|
Use these JP2 options for output image.
|
||||||
|
|
||||||
|
Requires libvips compiled with support for OpenJPEG.
|
||||||
|
The prebuilt binaries do not include this - see
|
||||||
|
[installing a custom libvips](https://sharp.pixelplumbing.com/install#custom-libvips).
|
||||||
|
|
||||||
|
|
||||||
|
**Throws**:
|
||||||
|
|
||||||
|
- <code>Error</code> Invalid options
|
||||||
|
|
||||||
|
**Since**: 0.29.1
|
||||||
|
|
||||||
|
| Param | Type | Default | Description |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| [options] | <code>Object</code> | | output options |
|
||||||
|
| [options.quality] | <code>number</code> | <code>80</code> | quality, integer 1-100 |
|
||||||
|
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression mode |
|
||||||
|
| [options.tileWidth] | <code>number</code> | <code>512</code> | horizontal tile size |
|
||||||
|
| [options.tileHeight] | <code>number</code> | <code>512</code> | vertical tile size |
|
||||||
|
| [options.chromaSubsampling] | <code>string</code> | <code>"'4:4:4'"</code> | set to '4:2:0' to use chroma subsampling |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Convert any input to lossless JP2 output
|
||||||
|
const data = await sharp(input)
|
||||||
|
.jp2({ lossless: true })
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Convert any input to very high quality JP2 output
|
||||||
|
const data = await sharp(input)
|
||||||
|
.jp2({
|
||||||
|
quality: 100,
|
||||||
|
chromaSubsampling: '4:4:4'
|
||||||
|
})
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## tiff
|
## tiff
|
||||||
|
File diff suppressed because one or more lines are too long
@ -632,6 +632,7 @@ function gif (options) {
|
|||||||
return this._updateFormatOut('gif', options);
|
return this._updateFormatOut('gif', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore next */
|
||||||
/**
|
/**
|
||||||
* Use these JP2 options for output image.
|
* Use these JP2 options for output image.
|
||||||
*
|
*
|
||||||
@ -665,7 +666,6 @@ function gif (options) {
|
|||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid options
|
* @throws {Error} Invalid options
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore next */
|
|
||||||
function jp2 (options) {
|
function jp2 (options) {
|
||||||
if (!this.constructor.format.jp2k.output.buffer) {
|
if (!this.constructor.format.jp2k.output.buffer) {
|
||||||
throw errJp2Save();
|
throw errJp2Save();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user