|
1 | 1 | module.exports = { |
2 | | - optimize: { |
3 | | - jpeg: { |
4 | | - // https://sharp.pixelplumbing.com/api-output#jpeg |
5 | | - lossy: { |
6 | | - quality: 80, // quality, integer 1-100 |
7 | | - progressive: true, // use progressive (interlace) scan |
8 | | - chromaSubsampling: '4:2:0', // set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling |
9 | | - optimizeCoding: true, // optimise Huffman coding tables |
10 | | - mozjpeg: false, // use mozjpeg defaults, equivalent to { trellisQuantisation: true, overshootDeringing: true, optimiseScans: true, quantisationTable: 3 } |
11 | | - trellisQuantisation: false, // apply trellis quantisation |
12 | | - overshootDeringing: false, // apply overshoot deringing |
13 | | - optimizeScans: false, // optimise progressive scans, forces progressive |
14 | | - quantizationTable: 0, // quantization table to use, integer 0-8 |
15 | | - }, |
16 | | - // https://github.com/google/guetzli |
17 | | - lossless: { |
18 | | - quality: 90, // visual quality to aim for, expressed as a JPEG quality value |
19 | | - memlimit: 6000, // memory limit in MB; guetzli will fail if unable to stay under the limit |
20 | | - nomemlimit: false, // do not limit memory usage |
21 | | - }, |
22 | | - }, |
| 2 | + optimize: { |
| 3 | + jpeg: { |
| 4 | + // https://sharp.pixelplumbing.com/api-output#jpeg |
| 5 | + lossy: { |
| 6 | + quality: 80, // quality, integer 1-100 |
| 7 | + progressive: true, // use progressive (interlace) scan |
| 8 | + chromaSubsampling: '4:2:0', // set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling |
| 9 | + optimizeCoding: true, // optimise Huffman coding tables |
| 10 | + mozjpeg: false, // use mozjpeg defaults, equivalent to { trellisQuantisation: true, overshootDeringing: true, optimiseScans: true, quantisationTable: 3 } |
| 11 | + trellisQuantisation: false, // apply trellis quantisation |
| 12 | + overshootDeringing: false, // apply overshoot deringing |
| 13 | + optimizeScans: false, // optimise progressive scans, forces progressive |
| 14 | + quantizationTable: 0, // quantization table to use, integer 0-8 |
| 15 | + }, |
| 16 | + // https://github.com/google/guetzli |
| 17 | + lossless: { |
| 18 | + quality: 90, // visual quality to aim for, expressed as a JPEG quality value |
| 19 | + memlimit: 6000, // memory limit in MB; guetzli will fail if unable to stay under the limit |
| 20 | + nomemlimit: false, // do not limit memory usage |
| 21 | + }, |
| 22 | + }, |
23 | 23 |
|
24 | | - // https://sharp.pixelplumbing.com/api-output#png |
25 | | - png: { |
26 | | - lossy: { |
27 | | - progressive: false, // use progressive (interlace) scan |
28 | | - compressionLevel: 9, // zlib compression level, 0 (fastest, largest) to 9 (slowest, smallest) |
29 | | - adaptiveFiltering: false, // use adaptive row filtering |
30 | | - palette: true, // quantise to a palette-based image with alpha transparency support |
31 | | - quality: 100, // use the lowest number of colours needed to achieve given quality, sets palette to true |
32 | | - effort: 7, // CPU effort, between 1 (fastest) and 10 (slowest), sets palette to true |
33 | | - colors: 256, // maximum number of palette entries, sets palette to true |
34 | | - dither: 1.0, // level of Floyd-Steinberg error diffusion, sets palette to true |
35 | | - }, |
36 | | - lossless: { |
37 | | - progressive: false, |
38 | | - compressionLevel: 9, |
39 | | - adaptiveFiltering: true, |
40 | | - palette: false, |
41 | | - quality: 100, |
42 | | - effort: 7, |
43 | | - colors: 256, |
44 | | - dither: 1.0, |
45 | | - }, |
46 | | - }, |
| 24 | + // https://sharp.pixelplumbing.com/api-output#png |
| 25 | + png: { |
| 26 | + lossy: { |
| 27 | + progressive: false, // use progressive (interlace) scan |
| 28 | + compressionLevel: 9, // zlib compression level, 0 (fastest, largest) to 9 (slowest, smallest) |
| 29 | + adaptiveFiltering: false, // use adaptive row filtering |
| 30 | + palette: true, // quantise to a palette-based image with alpha transparency support |
| 31 | + quality: 100, // use the lowest number of colours needed to achieve given quality, sets palette to true |
| 32 | + effort: 7, // CPU effort, between 1 (fastest) and 10 (slowest), sets palette to true |
| 33 | + colors: 256, // maximum number of palette entries, sets palette to true |
| 34 | + dither: 1.0, // level of Floyd-Steinberg error diffusion, sets palette to true |
| 35 | + }, |
| 36 | + lossless: { |
| 37 | + progressive: false, |
| 38 | + compressionLevel: 9, |
| 39 | + adaptiveFiltering: true, |
| 40 | + palette: false, |
| 41 | + quality: 100, |
| 42 | + effort: 7, |
| 43 | + colors: 256, |
| 44 | + dither: 1.0, |
| 45 | + }, |
| 46 | + }, |
47 | 47 |
|
48 | | - // http://www.lcdf.org/gifsicle/man.html |
49 | | - gif: { |
50 | | - lossy: { |
51 | | - optimize: 3, // attempt to shrink the file sizes of GIF animations; higher levels take longer, but may have better results; there are currently three levels |
52 | | - careful: false, // write larger GIFs that avoid bugs in other programs |
53 | | - colors: 256, // reduce the number of distinct colors to num or less; must be between 2 and 256 |
54 | | - lossy: 100, // alter image colors to shrink output file size at the cost of artifacts and noise |
55 | | - }, |
56 | | - lossless: { |
57 | | - optimize: 0, |
58 | | - careful: true, |
59 | | - colors: 256, |
60 | | - lossy: 0, |
61 | | - }, |
62 | | - }, |
| 48 | + // http://www.lcdf.org/gifsicle/man.html |
| 49 | + gif: { |
| 50 | + lossy: { |
| 51 | + optimize: 3, // attempt to shrink the file sizes of GIF animations; higher levels take longer, but may have better results; there are currently three levels |
| 52 | + careful: false, // write larger GIFs that avoid bugs in other programs |
| 53 | + colors: 256, // reduce the number of distinct colors to num or less; must be between 2 and 256 |
| 54 | + lossy: 100, // alter image colors to shrink output file size at the cost of artifacts and noise |
| 55 | + }, |
| 56 | + lossless: { |
| 57 | + optimize: 0, |
| 58 | + careful: true, |
| 59 | + colors: 256, |
| 60 | + lossy: 0, |
| 61 | + }, |
| 62 | + }, |
63 | 63 |
|
64 | | - // https://github.com/svg/svgo#configuration |
65 | | - svg: { |
66 | | - multipass: true, |
67 | | - js2svg: { |
68 | | - pretty: true, |
69 | | - indent: 2, |
70 | | - }, |
71 | | - plugins: [ |
72 | | - { |
73 | | - name: 'preset-default', |
74 | | - params: { |
75 | | - overrides: { |
76 | | - removeViewBox: false, |
77 | | - }, |
78 | | - }, |
79 | | - }, |
80 | | - 'cleanupListOfValues', |
81 | | - 'convertStyleToAttrs', |
82 | | - 'reusePaths', |
83 | | - ], |
84 | | - }, |
85 | | - }, |
| 64 | + // https://github.com/svg/svgo#configuration |
| 65 | + svg: { |
| 66 | + multipass: true, |
| 67 | + js2svg: { |
| 68 | + pretty: true, |
| 69 | + indent: 2, |
| 70 | + }, |
| 71 | + plugins: [ |
| 72 | + { |
| 73 | + name: 'preset-default', |
| 74 | + params: { |
| 75 | + overrides: { |
| 76 | + removeViewBox: false, |
| 77 | + }, |
| 78 | + }, |
| 79 | + }, |
| 80 | + 'cleanupListOfValues', |
| 81 | + 'convertStyleToAttrs', |
| 82 | + 'reusePaths', |
| 83 | + ], |
| 84 | + }, |
| 85 | + }, |
86 | 86 |
|
87 | | - convert: { |
88 | | - // https://sharp.pixelplumbing.com/api-output#avif |
89 | | - avif: { |
90 | | - lossy: { |
91 | | - quality: 50, // quality, integer 1-100 |
92 | | - lossless: false, // use lossless compression |
93 | | - effort: 4, // CPU effort, between 0 (fastest) and 9 (slowest) |
94 | | - chromaSubsampling: '4:4:4', // set to '4:2:0' to use chroma subsampling |
95 | | - bitdepth: 8, // set bitdepth to 8, 10 or 12 bit |
96 | | - }, |
97 | | - lossless: { |
98 | | - quality: 50, |
99 | | - lossless: true, |
100 | | - effort: 4, |
101 | | - chromaSubsampling: '4:4:4', |
102 | | - bitdepth: 8, // set bitdepth to 8, 10 or 12 bit |
103 | | - }, |
104 | | - }, |
| 87 | + convert: { |
| 88 | + // https://sharp.pixelplumbing.com/api-output#avif |
| 89 | + avif: { |
| 90 | + lossy: { |
| 91 | + quality: 50, // quality, integer 1-100 |
| 92 | + lossless: false, // use lossless compression |
| 93 | + effort: 4, // CPU effort, between 0 (fastest) and 9 (slowest) |
| 94 | + chromaSubsampling: '4:4:4', // set to '4:2:0' to use chroma subsampling |
| 95 | + }, |
| 96 | + lossless: { |
| 97 | + quality: 50, |
| 98 | + lossless: true, |
| 99 | + effort: 4, |
| 100 | + chromaSubsampling: '4:4:4', |
| 101 | + }, |
| 102 | + }, |
105 | 103 |
|
106 | | - // https://sharp.pixelplumbing.com/api-output#webp |
107 | | - webp: { |
108 | | - lossy: { |
109 | | - quality: 85, // quality, integer 1-100 |
110 | | - alphaQuality: 100, // quality of alpha layer, integer 0-100 |
111 | | - lossless: false, // use lossless compression mode |
112 | | - nearLossless: false, // use near_lossless compression mode |
113 | | - smartSubsample: false, // use high quality chroma subsampling |
| 104 | + // https://sharp.pixelplumbing.com/api-output#webp |
| 105 | + webp: { |
| 106 | + lossy: { |
| 107 | + quality: 85, // quality, integer 1-100 |
| 108 | + alphaQuality: 100, // quality of alpha layer, integer 0-100 |
| 109 | + lossless: false, // use lossless compression mode |
| 110 | + nearLossless: false, // use near_lossless compression mode |
| 111 | + smartSubsample: false, // use high quality chroma subsampling |
114 | 112 | preset: 'default', // named preset for preprocessing/filtering, one of: default, photo, picture, drawing, icon, text |
115 | | - effort: 4, // CPU effort, between 0 (fastest) and 6 (slowest) |
116 | | - minSize: false, // prevent use of animation key frames to minimise file size (slow) |
117 | | - mixed: false, // allow mixture of lossy and lossless animation frames (slow) |
118 | | - }, |
119 | | - lossless: { |
120 | | - quality: 85, |
121 | | - alphaQuality: 100, |
122 | | - lossless: true, |
123 | | - nearLossless: false, |
124 | | - smartSubsample: false, |
125 | | - effort: 4, |
126 | | - minSize: false, |
127 | | - mixed: false, |
128 | | - }, |
129 | | - }, |
| 113 | + effort: 4, // CPU effort, between 0 (fastest) and 6 (slowest) |
| 114 | + minSize: false, // prevent use of animation key frames to minimise file size (slow) |
| 115 | + mixed: false, // allow mixture of lossy and lossless animation frames (slow) |
| 116 | + }, |
| 117 | + lossless: { |
| 118 | + quality: 85, |
| 119 | + alphaQuality: 100, |
| 120 | + lossless: true, |
| 121 | + nearLossless: false, |
| 122 | + smartSubsample: false, |
| 123 | + effort: 4, |
| 124 | + minSize: false, |
| 125 | + mixed: false, |
| 126 | + }, |
| 127 | + }, |
130 | 128 |
|
131 | | - // https://developers.google.com/speed/webp/docs/gif2webp |
132 | | - webpGif: { |
133 | | - lossy: { |
134 | | - lossy: true, // encode image using lossy compression |
135 | | - mixed: false, // for each frame in the image, pick lossy or lossless compression heuristically |
136 | | - q: 75, // in case of lossy compression, a small factor produces a smaller file with lower quality; best quality is achieved by using a value of 100 |
137 | | - m: 6, // compression method (0=fast, 6=slowest) |
138 | | - min_size: true, // minimize output size; can be combined with -q, -m, -lossy or -mixed options |
139 | | - f: 0, // filter strength (0=off..100); for lossy encoding only |
140 | | - metadata: 'xmp', // comma separated list of metadata to copy from the input to the output if present; valid values: all, none, icc, xmp |
141 | | - loop_compatibility: false, // use compatibility mode for Chrome version prior to M62 (inclusive) |
142 | | - mt: true, // use multi-threading if available |
143 | | - }, |
144 | | - lossless: { |
145 | | - lossy: false, |
146 | | - mixed: false, |
147 | | - q: 100, |
148 | | - m: false, |
149 | | - min_size: false, |
150 | | - metadata: 'xmp', |
151 | | - loop_compatibility: false, |
152 | | - mt: true, |
153 | | - }, |
154 | | - }, |
155 | | - }, |
| 129 | + // https://developers.google.com/speed/webp/docs/gif2webp |
| 130 | + webpGif: { |
| 131 | + lossy: { |
| 132 | + lossy: true, // encode image using lossy compression |
| 133 | + mixed: false, // for each frame in the image, pick lossy or lossless compression heuristically |
| 134 | + q: 75, // in case of lossy compression, a small factor produces a smaller file with lower quality; best quality is achieved by using a value of 100 |
| 135 | + m: 6, // compression method (0=fast, 6=slowest) |
| 136 | + min_size: true, // minimize output size; can be combined with -q, -m, -lossy or -mixed options |
| 137 | + f: 0, // filter strength (0=off..100); for lossy encoding only |
| 138 | + metadata: 'xmp', // comma separated list of metadata to copy from the input to the output if present; valid values: all, none, icc, xmp |
| 139 | + loop_compatibility: false, // use compatibility mode for Chrome version prior to M62 (inclusive) |
| 140 | + mt: true, // use multi-threading if available |
| 141 | + }, |
| 142 | + lossless: { |
| 143 | + lossy: false, |
| 144 | + mixed: false, |
| 145 | + q: 100, |
| 146 | + m: false, |
| 147 | + min_size: false, |
| 148 | + metadata: 'xmp', |
| 149 | + loop_compatibility: false, |
| 150 | + mt: true, |
| 151 | + }, |
| 152 | + }, |
| 153 | + }, |
156 | 154 | }; |
0 commit comments