Nest format-specific constructor params (deprecate at top-level)

- `subifd` -> `tiff.subifd`
- `level` -> `openSlide.level`
- `pdfBackground` -> `pdf.background`
This commit is contained in:
Lovell Fuller
2025-06-16 07:51:36 +01:00
parent 8c53d499f7
commit f92540f134
8 changed files with 163 additions and 69 deletions

View File

@@ -435,9 +435,6 @@ sharp('input.jpg').clahe({ width: 10, height: 10, maxSlope: 5 }).toFile('outfile
// Support `unlimited` input option
sharp('input.png', { unlimited: true }).resize(320, 240).toFile('outfile.png');
// Support `subifd` input option for tiffs
sharp('input.tiff', { subifd: 3 }).resize(320, 240).toFile('outfile.png');
// Support creating with noise
sharp({
create: {
@@ -720,13 +717,19 @@ sharp(input).composite([
}
])
// Support format-specific input options
const colour: sharp.Colour = '#fff';
const color: sharp.Color = '#fff';
sharp({ pdfBackground: colour });
sharp({ pdfBackground: color });
sharp({ jp2Oneshot: true });
sharp({ jp2Oneshot: false });
sharp({ pdf: { background: colour } });
sharp({ pdf: { background: color } });
sharp({ pdfBackground: colour }); // Deprecated
sharp({ pdfBackground: color }); // Deprecated
sharp({ tiff: { subifd: 3 } });
sharp({ subifd: 3 }); // Deprecated
sharp({ openSlide: { level: 0 } });
sharp({ level: 0 }); // Deprecated
sharp({ jp2: { oneshot: true } });
sharp({ jp2: { oneshot: false } });
sharp({ autoOrient: true });
sharp({ autoOrient: false });