converting heic image to png / jpeg with sharp node.js

1.1k Views Asked by At

When I want to convert png file like this

const file = await this.awsS3Service.getObject(fileEntity.awsS3Key);

const body = await this.awsS3Service.streamToBuffer(file.Body as Readable);

const outputBuffer = await sharp(body).toFormat('png').toBuffer();

i get file from aws and then convert file to buffer and then want to convert heic image to png or jpeg image. On this line await sharp(body).toFormat('png').toBuffer(); I get error Stack: Error: source: bad seek to 1508850 heif: Unsupported feature: Unsupported codec (4.3000)

I tried also

const outputBuffer = await sharp(body).png().toBuffer();

, but this was working like one month ago

0

There are 0 best solutions below