'Convert Base64 Image into LZW compressed TIFF images
i have a nodejs program that previously used sharp package to convert image to lzw compressed TIFF images as below. It gets the photo from s3 and converts to TIFF.
const image: Buffer = <Buffer>await this.s3Accessor.read(filePath); //download from aws s3 bucket
const tiff = await Sharp(image)
.tiff({
compression: 'lzw',
}).toBuffer();
return tiff.toString("base64"); //convert to tiff with lzw compression, use base64 string for API call
However, recently i introduced webpack to pack my lambdas, and sharp package is not compatible in webpack.
Is there any alternative package that can be used to convert images to tiff with lzw compression? I tried using JIMP, but it doesn't come with LZW compression and the TIFF file generated JIMP is just too huge compared to the one by Sharp
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|