mirror of
https://github.com/lovell/sharp.git
synced 2025-07-12 20:10:13 +02:00
Default AVIF encoding to 4:4:4 chroma subsampling #2562
This commit is contained in:
parent
e418d91511
commit
75cddbdb6d
@ -379,7 +379,7 @@ most web browsers do not display these properly.
|
|||||||
* `options.quality` **[number][9]** quality, integer 1-100 (optional, default `50`)
|
* `options.quality` **[number][9]** quality, integer 1-100 (optional, default `50`)
|
||||||
* `options.lossless` **[boolean][7]** use lossless compression (optional, default `false`)
|
* `options.lossless` **[boolean][7]** use lossless compression (optional, default `false`)
|
||||||
* `options.speed` **[number][9]** CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest) (optional, default `5`)
|
* `options.speed` **[number][9]** CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest) (optional, default `5`)
|
||||||
* `options.chromaSubsampling` **[string][2]** set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling, requires libvips v8.11.0 (optional, default `'4:2:0'`)
|
* `options.chromaSubsampling` **[string][2]** set to '4:2:0' to use chroma subsampling (optional, default `'4:4:4'`)
|
||||||
|
|
||||||
<!---->
|
<!---->
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ globally-installed libvips compiled with support for libheif, libde265 and x265.
|
|||||||
* `options.compression` **[string][2]** compression format: av1, hevc (optional, default `'av1'`)
|
* `options.compression` **[string][2]** compression format: av1, hevc (optional, default `'av1'`)
|
||||||
* `options.lossless` **[boolean][7]** use lossless compression (optional, default `false`)
|
* `options.lossless` **[boolean][7]** use lossless compression (optional, default `false`)
|
||||||
* `options.speed` **[number][9]** CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest) (optional, default `5`)
|
* `options.speed` **[number][9]** CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest) (optional, default `5`)
|
||||||
* `options.chromaSubsampling` **[string][2]** set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling, requires libvips v8.11.0 (optional, default `'4:2:0'`)
|
* `options.chromaSubsampling` **[string][2]** set to '4:2:0' to use chroma subsampling (optional, default `'4:4:4'`)
|
||||||
|
|
||||||
<!---->
|
<!---->
|
||||||
|
|
||||||
|
@ -8,6 +8,9 @@ Requires libvips v8.11.0
|
|||||||
|
|
||||||
* Drop support for Node.js 10, now requires Node.js >= 12.13.0.
|
* Drop support for Node.js 10, now requires Node.js >= 12.13.0.
|
||||||
|
|
||||||
|
* AVIF encoding now defaults to `4:4:4` chroma subsampling.
|
||||||
|
[#2562](https://github.com/lovell/sharp/issues/2562)
|
||||||
|
|
||||||
* Allow multiple platform-arch binaries in same `node_modules` installation tree.
|
* Allow multiple platform-arch binaries in same `node_modules` installation tree.
|
||||||
[#2575](https://github.com/lovell/sharp/issues/2575)
|
[#2575](https://github.com/lovell/sharp/issues/2575)
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -251,7 +251,7 @@ const Sharp = function (input, options) {
|
|||||||
heifLossless: false,
|
heifLossless: false,
|
||||||
heifCompression: 'av1',
|
heifCompression: 'av1',
|
||||||
heifSpeed: 5,
|
heifSpeed: 5,
|
||||||
heifChromaSubsampling: '4:2:0',
|
heifChromaSubsampling: '4:4:4',
|
||||||
tileSize: 256,
|
tileSize: 256,
|
||||||
tileOverlap: 0,
|
tileOverlap: 0,
|
||||||
tileContainer: 'fs',
|
tileContainer: 'fs',
|
||||||
|
@ -660,7 +660,7 @@ function tiff (options) {
|
|||||||
* @param {number} [options.quality=50] - quality, integer 1-100
|
* @param {number} [options.quality=50] - quality, integer 1-100
|
||||||
* @param {boolean} [options.lossless=false] - use lossless compression
|
* @param {boolean} [options.lossless=false] - use lossless compression
|
||||||
* @param {number} [options.speed=5] - CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest)
|
* @param {number} [options.speed=5] - CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest)
|
||||||
* @param {string} [options.chromaSubsampling='4:2:0'] - set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling, requires libvips v8.11.0
|
* @param {string} [options.chromaSubsampling='4:4:4'] - set to '4:2:0' to use chroma subsampling
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid options
|
* @throws {Error} Invalid options
|
||||||
*/
|
*/
|
||||||
@ -681,7 +681,7 @@ function avif (options) {
|
|||||||
* @param {string} [options.compression='av1'] - compression format: av1, hevc
|
* @param {string} [options.compression='av1'] - compression format: av1, hevc
|
||||||
* @param {boolean} [options.lossless=false] - use lossless compression
|
* @param {boolean} [options.lossless=false] - use lossless compression
|
||||||
* @param {number} [options.speed=5] - CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest)
|
* @param {number} [options.speed=5] - CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest)
|
||||||
* @param {string} [options.chromaSubsampling='4:2:0'] - set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling, requires libvips v8.11.0
|
* @param {string} [options.chromaSubsampling='4:4:4'] - set to '4:2:0' to use chroma subsampling
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid options
|
* @throws {Error} Invalid options
|
||||||
*/
|
*/
|
||||||
|
@ -765,8 +765,8 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|||||||
->set("Q", baton->jpegQuality)
|
->set("Q", baton->jpegQuality)
|
||||||
->set("interlace", baton->jpegProgressive)
|
->set("interlace", baton->jpegProgressive)
|
||||||
->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
|
->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
|
||||||
? VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
|
? VIPS_FOREIGN_SUBSAMPLE_OFF
|
||||||
: VIPS_FOREIGN_JPEG_SUBSAMPLE_ON)
|
: VIPS_FOREIGN_SUBSAMPLE_ON)
|
||||||
->set("trellis_quant", baton->jpegTrellisQuantisation)
|
->set("trellis_quant", baton->jpegTrellisQuantisation)
|
||||||
->set("quant_table", baton->jpegQuantisationTable)
|
->set("quant_table", baton->jpegQuantisationTable)
|
||||||
->set("overshoot_deringing", baton->jpegOvershootDeringing)
|
->set("overshoot_deringing", baton->jpegOvershootDeringing)
|
||||||
@ -865,13 +865,11 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|||||||
// Write HEIF to buffer
|
// Write HEIF to buffer
|
||||||
VipsArea *area = reinterpret_cast<VipsArea*>(image.heifsave_buffer(VImage::option()
|
VipsArea *area = reinterpret_cast<VipsArea*>(image.heifsave_buffer(VImage::option()
|
||||||
->set("strip", !baton->withMetadata)
|
->set("strip", !baton->withMetadata)
|
||||||
->set("compression", baton->heifCompression)
|
|
||||||
->set("Q", baton->heifQuality)
|
->set("Q", baton->heifQuality)
|
||||||
|
->set("compression", baton->heifCompression)
|
||||||
->set("speed", baton->heifSpeed)
|
->set("speed", baton->heifSpeed)
|
||||||
#if defined(VIPS_TYPE_FOREIGN_SUBSAMPLE)
|
|
||||||
->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
|
->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
|
||||||
? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
|
? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
|
||||||
#endif
|
|
||||||
->set("lossless", baton->heifLossless)));
|
->set("lossless", baton->heifLossless)));
|
||||||
baton->bufferOut = static_cast<char*>(area->data);
|
baton->bufferOut = static_cast<char*>(area->data);
|
||||||
baton->bufferOutLength = area->length;
|
baton->bufferOutLength = area->length;
|
||||||
@ -931,8 +929,8 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|||||||
->set("Q", baton->jpegQuality)
|
->set("Q", baton->jpegQuality)
|
||||||
->set("interlace", baton->jpegProgressive)
|
->set("interlace", baton->jpegProgressive)
|
||||||
->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
|
->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
|
||||||
? VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
|
? VIPS_FOREIGN_SUBSAMPLE_OFF
|
||||||
: VIPS_FOREIGN_JPEG_SUBSAMPLE_ON)
|
: VIPS_FOREIGN_SUBSAMPLE_ON)
|
||||||
->set("trellis_quant", baton->jpegTrellisQuantisation)
|
->set("trellis_quant", baton->jpegTrellisQuantisation)
|
||||||
->set("quant_table", baton->jpegQuantisationTable)
|
->set("quant_table", baton->jpegQuantisationTable)
|
||||||
->set("overshoot_deringing", baton->jpegOvershootDeringing)
|
->set("overshoot_deringing", baton->jpegOvershootDeringing)
|
||||||
@ -1010,10 +1008,8 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|||||||
->set("Q", baton->heifQuality)
|
->set("Q", baton->heifQuality)
|
||||||
->set("compression", baton->heifCompression)
|
->set("compression", baton->heifCompression)
|
||||||
->set("speed", baton->heifSpeed)
|
->set("speed", baton->heifSpeed)
|
||||||
#if defined(VIPS_TYPE_FOREIGN_SUBSAMPLE)
|
|
||||||
->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
|
->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
|
||||||
? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
|
? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
|
||||||
#endif
|
|
||||||
->set("lossless", baton->heifLossless));
|
->set("lossless", baton->heifLossless));
|
||||||
baton->formatOut = "heif";
|
baton->formatOut = "heif";
|
||||||
} else if (baton->formatOut == "dz" || isDz || isDzZip) {
|
} else if (baton->formatOut == "dz" || isDz || isDzZip) {
|
||||||
|
@ -293,7 +293,7 @@ struct PipelineBaton {
|
|||||||
heifQuality(50),
|
heifQuality(50),
|
||||||
heifCompression(VIPS_FOREIGN_HEIF_COMPRESSION_AV1),
|
heifCompression(VIPS_FOREIGN_HEIF_COMPRESSION_AV1),
|
||||||
heifSpeed(5),
|
heifSpeed(5),
|
||||||
heifChromaSubsampling("4:2:0"),
|
heifChromaSubsampling("4:4:4"),
|
||||||
heifLossless(false),
|
heifLossless(false),
|
||||||
withMetadata(false),
|
withMetadata(false),
|
||||||
withMetadataOrientation(-1),
|
withMetadataOrientation(-1),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user