Skip to content

Commit

Permalink
Disable fastShrinkOnLoad for the sacle lower than 0.125.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wentao-Kuang committed Dec 5, 2024
1 parent a7cb281 commit 15ca4ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/tiler-sharp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ export class TileMakerSharp implements TileMaker {

if (resize) {
const resizeOptions = { fit: Sharp.fit.cover, kernel: resize.scaleX > 1 ? resizeKernel.in : resizeKernel.out };
sharp.resize(resize.width, resize.height, resizeOptions);
if (resize.scale <= 0.1251) {
sharp.resize(resize.width, resize.height, { ...resizeOptions, fastShrinkOnLoad: false });
} else {
sharp.resize(resize.width, resize.height, resizeOptions);
}
}

if (crop) sharp.extract({ top: crop.y, left: crop.x, width: crop.width, height: crop.height });
Expand Down

0 comments on commit 15ca4ad

Please sign in to comment.