Sharp.js returns incorrect dimensions

Viewed 90

Sharp.js returns incorrect dimensions (low resolution) for some images when processing multiple images simultaneously. All images are having high resolution. Here is the code. Can somebody help what am I missing?

    let data = await sharp(file).metadata();

    if(data && data.orientation) {
        let buffer = await sharp(file).rotate().withMetadata().toBuffer();
        fs.writeFileSync(file, buffer);
    }
0 Answers
Related