我需要将多个png拼接成一个长png,我相信我可以使用Jimp的blit方法:
// blit the image with another Jimp image at x, y, optionally cropped.
image.blit( src, x, y, [srcx, srcy, srcw, srch] );
我的问题是,我如何循环所有的 png 并使当前的 png 附加到前一个的末尾?例如,它们都在同一个文件夹中,文件名如 img-1、img-2 ... img-10。而且它们的大小不一定相同。这就是我的想法,任何建议将不胜感激!
// This is dummy code
const bg = white_background
bg.width = Math.max(img-1...img-10 width)
bg.height = sum(img-1...img-10 height)
for (let i=0;i<imgs.length;i++) {
if(i=0) bg.blit(img, 0, 0)
else bg.blit(img, imgs[i-1].width, imgs[i-1].height)
}