mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Update output docs to include tile image format.
Correct some of the JPEG output option type defs.
This commit is contained in:
parent
bc84d1e47a
commit
dd9d66ef20
@ -64,11 +64,11 @@ Use these JPEG options for output image.
|
||||
- `options.quality` **\[[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** quality, integer 1-100 (optional, default `80`)
|
||||
- `options.progressive` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** use progressive (interlace) scan (optional, default `false`)
|
||||
- `options.chromaSubsampling` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** set to '4:4:4' to prevent chroma subsampling when quality <= 90 (optional, default `'4:2:0'`)
|
||||
- `options.trellisQuantisation` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** apply trellis quantisation, requires mozjpeg (optional, default `false`)
|
||||
- `options.overshootDeringing` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** apply overshoot deringing, requires mozjpeg (optional, default `false`)
|
||||
- `options.optimiseScans` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** optimise progressive scans, forces progressive, requires mozjpeg (optional, default `false`)
|
||||
- `options.optimizeScans` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** alternative spelling of optimiseScans (optional, default `false`)
|
||||
- `options.force` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** force JPEG output, otherwise attempt to use input format (optional, default `true`)
|
||||
- `trellisQuantisation` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** apply trellis quantisation, requires mozjpeg (optional, default `false`)
|
||||
- `overshootDeringing` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** apply overshoot deringing, requires mozjpeg (optional, default `false`)
|
||||
- `optimiseScans` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** optimise progressive scans, forces progressive, requires mozjpeg (optional, default `false`)
|
||||
- `optimizeScans` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** alternative spelling of optimiseScans (optional, default `false`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid options
|
||||
@ -145,7 +145,8 @@ Returns **Sharp**
|
||||
# tile
|
||||
|
||||
Use tile-based deep zoom (image pyramid) output.
|
||||
You can also use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
|
||||
Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
|
||||
**Parameters**
|
||||
|
||||
@ -159,6 +160,7 @@ You can also use a `.zip` or `.szi` file extension with `toFile` to write to a c
|
||||
|
||||
```javascript
|
||||
sharp('input.tiff')
|
||||
.png()
|
||||
.tile({
|
||||
size: 512
|
||||
})
|
||||
|
@ -26,6 +26,10 @@ Requires libvips v8.4.2.
|
||||
[#601](https://github.com/lovell/sharp/issues/601)
|
||||
[@dynamite-ready](https://github.com/dynamite-ready)
|
||||
|
||||
* Add support for PNG and WebP tile-based output formats (in addition to JPEG).
|
||||
[#622](https://github.com/lovell/sharp/pull/622)
|
||||
[@ppaskaris](https://github.com/ppaskaris)
|
||||
|
||||
### v0.16 - "*pencil*"
|
||||
|
||||
Requires libvips v8.3.3
|
||||
|
@ -88,10 +88,10 @@ const withMetadata = function withMetadata (withMetadata) {
|
||||
* @param {Number} [options.quality=80] - quality, integer 1-100
|
||||
* @param {Boolean} [options.progressive=false] - use progressive (interlace) scan
|
||||
* @param {String} [options.chromaSubsampling='4:2:0'] - set to '4:4:4' to prevent chroma subsampling when quality <= 90
|
||||
* @param {Boolean} [trellisQuantisation=false] - apply trellis quantisation, requires mozjpeg
|
||||
* @param {Boolean} [overshootDeringing=false] - apply overshoot deringing, requires mozjpeg
|
||||
* @param {Boolean} [optimiseScans=false] - optimise progressive scans, forces progressive, requires mozjpeg
|
||||
* @param {Boolean} [optimizeScans=false] - alternative spelling of optimiseScans
|
||||
* @param {Boolean} [options.trellisQuantisation=false] - apply trellis quantisation, requires mozjpeg
|
||||
* @param {Boolean} [options.overshootDeringing=false] - apply overshoot deringing, requires mozjpeg
|
||||
* @param {Boolean} [options.optimiseScans=false] - optimise progressive scans, forces progressive, requires mozjpeg
|
||||
* @param {Boolean} [options.optimizeScans=false] - alternative spelling of optimiseScans
|
||||
* @param {Boolean} [options.force=true] - force JPEG output, otherwise attempt to use input format
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid options
|
||||
@ -227,10 +227,12 @@ const toFormat = function toFormat (format, options) {
|
||||
|
||||
/**
|
||||
* Use tile-based deep zoom (image pyramid) output.
|
||||
* You can also use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
* Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
|
||||
* Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
*
|
||||
* @example
|
||||
* sharp('input.tiff')
|
||||
* .png()
|
||||
* .tile({
|
||||
* size: 512
|
||||
* })
|
||||
|
14
lib/types.d.ts
vendored
14
lib/types.d.ts
vendored
@ -770,15 +770,15 @@ declare function withMetadata(withMetadata?: { orientation: Number }): Sharp;
|
||||
* @param {Number} [options.quality=80] - quality, integer 1-100
|
||||
* @param {Boolean} [options.progressive=false] - use progressive (interlace) scan
|
||||
* @param {String} [options.chromaSubsampling='4:2:0'] - set to '4:4:4' to prevent chroma subsampling when quality <= 90
|
||||
* @param {Boolean} [trellisQuantisation=false] - apply trellis quantisation, requires mozjpeg
|
||||
* @param {Boolean} [overshootDeringing=false] - apply overshoot deringing, requires mozjpeg
|
||||
* @param {Boolean} [optimiseScans=false] - optimise progressive scans, forces progressive, requires mozjpeg
|
||||
* @param {Boolean} [optimizeScans=false] - alternative spelling of optimiseScans
|
||||
* @param {Boolean} [options.trellisQuantisation=false] - apply trellis quantisation, requires mozjpeg
|
||||
* @param {Boolean} [options.overshootDeringing=false] - apply overshoot deringing, requires mozjpeg
|
||||
* @param {Boolean} [options.optimiseScans=false] - optimise progressive scans, forces progressive, requires mozjpeg
|
||||
* @param {Boolean} [options.optimizeScans=false] - alternative spelling of optimiseScans
|
||||
* @param {Boolean} [options.force=true] - force JPEG output, otherwise attempt to use input format
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid options
|
||||
*/
|
||||
declare function jpeg(options?: { quality: Number, progressive: Boolean, chromaSubsampling: String, force: Boolean }, trellisQuantisation?: Boolean, overshootDeringing?: Boolean, optimiseScans?: Boolean, optimizeScans?: Boolean): Sharp;
|
||||
declare function jpeg(options?: { quality: Number, progressive: Boolean, chromaSubsampling: String, trellisQuantisation: Boolean, overshootDeringing: Boolean, optimiseScans: Boolean, optimizeScans: Boolean, force: Boolean }): Sharp;
|
||||
|
||||
/**
|
||||
* Use these PNG options for output image.
|
||||
@ -829,10 +829,12 @@ declare function toFormat(format: (String|Object), options: Object): Sharp;
|
||||
|
||||
/**
|
||||
* Use tile-based deep zoom (image pyramid) output.
|
||||
* You can also use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
* Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
|
||||
* Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
*
|
||||
* @example
|
||||
* sharp('input.tiff')
|
||||
* .png()
|
||||
* .tile({
|
||||
* size: 512
|
||||
* })
|
||||
|
@ -263,8 +263,8 @@ describe('Tile', function () {
|
||||
assert.strictEqual(3, metadata.channels);
|
||||
assert.strictEqual(false, metadata.hasProfile);
|
||||
assert.strictEqual(false, metadata.hasAlpha);
|
||||
assert.strictEqual(true, metadata.width === 256);
|
||||
assert.strictEqual(true, metadata.height === 256);
|
||||
assert.strictEqual(256, metadata.width);
|
||||
assert.strictEqual(256, metadata.height);
|
||||
fs.stat(sample, function (err, stat) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, stat.size < 2000);
|
||||
@ -298,8 +298,8 @@ describe('Tile', function () {
|
||||
assert.strictEqual(3, metadata.channels);
|
||||
assert.strictEqual(false, metadata.hasProfile);
|
||||
assert.strictEqual(false, metadata.hasAlpha);
|
||||
assert.strictEqual(true, metadata.width === 256);
|
||||
assert.strictEqual(true, metadata.height === 256);
|
||||
assert.strictEqual(256, metadata.width);
|
||||
assert.strictEqual(256, metadata.height);
|
||||
fs.stat(sample, function (err, stat) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, stat.size > 44000);
|
||||
@ -333,8 +333,8 @@ describe('Tile', function () {
|
||||
assert.strictEqual(3, metadata.channels);
|
||||
assert.strictEqual(false, metadata.hasProfile);
|
||||
assert.strictEqual(false, metadata.hasAlpha);
|
||||
assert.strictEqual(true, metadata.width === 256);
|
||||
assert.strictEqual(true, metadata.height === 256);
|
||||
assert.strictEqual(256, metadata.width);
|
||||
assert.strictEqual(256, metadata.height);
|
||||
fs.stat(sample, function (err, stat) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, stat.size < 2000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user