Merge pull request #10 from compliment/posterize

Fix(posterize): Resolve incorrect vertical tiling/cropping
This commit is contained in:
Alam
2025-10-14 12:33:33 +05:30
committed by GitHub

View File

@@ -135,9 +135,12 @@ export async function posterize() {
const offsetX = (targetWidth - scaledTileWidth) / 2;
const offsetY = (targetHeight - scaledTileHeight) / 2;
const tileRowIndexFromBottom = rows - 1 - r;
const overlapOffset = tileRowIndexFromBottom * overlapInPoints;
newPage.drawPage(embeddedPage, {
x: -c * scaledTileWidth + offsetX - (c * overlapInPoints),
y: r * scaledTileHeight + offsetY - ((rows - 1 - r) * overlapInPoints),
y: -tileRowIndexFromBottom * scaledTileHeight + offsetY + overlapOffset,
width: sourceWidth * scale,
height: sourceHeight * scale,
});