mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
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 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) {
|
||||
const newWidth = Math.round(Math.sqrt((input.size * input.size) / ratio));
|
||||
image.resize(newWidth, null, {
|
||||
kernel: kernel,
|
||||
interpolator: interpolator
|
||||
kernel: kernel
|
||||
});
|
||||
|
||||
} else {
|
||||
image
|
||||
.resize(input.size, input.size, {
|
||||
kernel: kernel,
|
||||
interpolator: interpolator
|
||||
kernel: kernel
|
||||
})
|
||||
.crop(sharp.strategy.center);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user