fixing sharp error
This commit is contained in:
parent
63b300c40a
commit
9e967c69cd
@ -101,19 +101,16 @@ export class RendererFactory {
|
|||||||
*/
|
*/
|
||||||
const ratio = metadata.height / metadata.width;
|
const ratio = metadata.height / metadata.width;
|
||||||
const kernel = input.qualityPriority == true ? sharp.kernel.lanczos3 : sharp.kernel.nearest;
|
const kernel = input.qualityPriority == true ? sharp.kernel.lanczos3 : sharp.kernel.nearest;
|
||||||
const interpolator = input.qualityPriority == true ? sharp.interpolator.bicubic : sharp.interpolator.nearest;
|
|
||||||
if (input.makeSquare == false) {
|
if (input.makeSquare == false) {
|
||||||
const newWidth = Math.round(Math.sqrt((input.size * input.size) / ratio));
|
const newWidth = Math.round(Math.sqrt((input.size * input.size) / ratio));
|
||||||
image.resize(newWidth, null, {
|
image.resize(newWidth, null, {
|
||||||
kernel: kernel,
|
kernel: kernel
|
||||||
interpolator: interpolator
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
image
|
image
|
||||||
.resize(input.size, input.size, {
|
.resize(input.size, input.size, {
|
||||||
kernel: kernel,
|
kernel: kernel
|
||||||
interpolator: interpolator
|
|
||||||
})
|
})
|
||||||
.crop(sharp.strategy.center);
|
.crop(sharp.strategy.center);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user