fix: normalize scale adjust verification samples
This commit is contained in:
parent
b6296d4022
commit
c0e16a354f
@ -361,18 +361,21 @@ async function getScaleAdjustRegionSample(params: {
|
||||
sourceHeight: number;
|
||||
region: CanvasLocalEditCompositeRegion;
|
||||
}) {
|
||||
const normalizedBuffer = await sharp(params.buffer, { failOn: "none" })
|
||||
.rotate()
|
||||
.resize(params.sourceWidth, params.sourceHeight, {
|
||||
fit: "cover",
|
||||
position: "center",
|
||||
})
|
||||
.png({ compressionLevel: 6 })
|
||||
.toBuffer();
|
||||
const box = rectToPixelBox({
|
||||
region: params.region,
|
||||
width: params.sourceWidth,
|
||||
height: params.sourceHeight,
|
||||
});
|
||||
|
||||
return sharp(params.buffer, { failOn: "none" })
|
||||
.rotate()
|
||||
.resize(params.sourceWidth, params.sourceHeight, {
|
||||
fit: "cover",
|
||||
position: "center",
|
||||
})
|
||||
return sharp(normalizedBuffer, { failOn: "none" })
|
||||
.extract(box)
|
||||
.resize(SCALE_ADJUST_DIFF_SAMPLE_SIZE, SCALE_ADJUST_DIFF_SAMPLE_SIZE, {
|
||||
fit: "fill",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user