mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 02:30:12 +02:00
Add Magic Kernel Sharp (no relation) to resizing kernels
This commit is contained in:
parent
8669fbc936
commit
9392b8702b
@ -38,6 +38,8 @@ Possible downsizing kernels are:
|
|||||||
- `mitchell`: Use a [Mitchell-Netravali spline](https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf).
|
- `mitchell`: Use a [Mitchell-Netravali spline](https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf).
|
||||||
- `lanczos2`: Use a [Lanczos kernel](https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel) with `a=2`.
|
- `lanczos2`: Use a [Lanczos kernel](https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel) with `a=2`.
|
||||||
- `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
|
- `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
|
||||||
|
- `mks2013`: Use a [Magic Kernel Sharp](https://johncostella.com/magic/mks.pdf) 2013 kernel, as adopted by Facebook.
|
||||||
|
- `mks2021`: Use a Magic Kernel Sharp 2021 kernel, with more accurate (reduced) sharpening than the 2013 version.
|
||||||
|
|
||||||
When upsampling, these kernels map to `nearest`, `linear` and `cubic` interpolators.
|
When upsampling, these kernels map to `nearest`, `linear` and `cubic` interpolators.
|
||||||
Downsampling kernels without a matching upsampling interpolator map to `cubic`.
|
Downsampling kernels without a matching upsampling interpolator map to `cubic`.
|
||||||
|
@ -10,6 +10,8 @@ Requires libvips v8.17.0
|
|||||||
|
|
||||||
* Upgrade to libvips v8.17.0 for upstream bug fixes.
|
* Upgrade to libvips v8.17.0 for upstream bug fixes.
|
||||||
|
|
||||||
|
* Add "Magic Kernel Sharp" (no relation) to resizing kernels.
|
||||||
|
|
||||||
* Expose JPEG 2000 `oneshot` decoder option.
|
* Expose JPEG 2000 `oneshot` decoder option.
|
||||||
[#4262](https://github.com/lovell/sharp/pull/4262)
|
[#4262](https://github.com/lovell/sharp/pull/4262)
|
||||||
[@mbklein](https://github.com/mbklein)
|
[@mbklein](https://github.com/mbklein)
|
||||||
|
2
lib/index.d.ts
vendored
2
lib/index.d.ts
vendored
@ -1729,6 +1729,8 @@ declare namespace sharp {
|
|||||||
mitchell: 'mitchell';
|
mitchell: 'mitchell';
|
||||||
lanczos2: 'lanczos2';
|
lanczos2: 'lanczos2';
|
||||||
lanczos3: 'lanczos3';
|
lanczos3: 'lanczos3';
|
||||||
|
mks2013: 'mks2013';
|
||||||
|
mks2021: 'mks2021';
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PresetEnum {
|
interface PresetEnum {
|
||||||
|
@ -150,6 +150,8 @@ function isResizeExpected (options) {
|
|||||||
* - `mitchell`: Use a [Mitchell-Netravali spline](https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf).
|
* - `mitchell`: Use a [Mitchell-Netravali spline](https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf).
|
||||||
* - `lanczos2`: Use a [Lanczos kernel](https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel) with `a=2`.
|
* - `lanczos2`: Use a [Lanczos kernel](https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel) with `a=2`.
|
||||||
* - `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
|
* - `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
|
||||||
|
* - `mks2013`: Use a [Magic Kernel Sharp](https://johncostella.com/magic/mks.pdf) 2013 kernel, as adopted by Facebook.
|
||||||
|
* - `mks2021`: Use a Magic Kernel Sharp 2021 kernel, with more accurate (reduced) sharpening than the 2013 version.
|
||||||
*
|
*
|
||||||
* When upsampling, these kernels map to `nearest`, `linear` and `cubic` interpolators.
|
* When upsampling, these kernels map to `nearest`, `linear` and `cubic` interpolators.
|
||||||
* Downsampling kernels without a matching upsampling interpolator map to `cubic`.
|
* Downsampling kernels without a matching upsampling interpolator map to `cubic`.
|
||||||
|
@ -188,6 +188,8 @@ sharp(input)
|
|||||||
// of the image data in inputBuffer
|
// of the image data in inputBuffer
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sharp(input).resize({ kernel: 'mks2013' });
|
||||||
|
|
||||||
transformer = sharp()
|
transformer = sharp()
|
||||||
.resize(200, 200, {
|
.resize(200, 200, {
|
||||||
fit: 'cover',
|
fit: 'cover',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user