HEIF produced by sharp is corrupted
See original GitHub issuePossible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
- Running
npm install sharp
completes without error. - Running
node -e "require('sharp')"
completes without error.
If you cannot confirm both of these, please open an installation issue instead.
Are you using the latest version of sharp?
- I am using the latest version of
sharp
as reported bynpm view sharp dist-tags.latest
.
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of sharp
that is not the latest, please open an issue against that package instead.
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?
npx: installed 1 in 2.023s
System: OS: Linux 5.4 Ubuntu 20.04.4 LTS (Focal Fossa) CPU: (8) x64 Intel® Core™ i7-6850K CPU @ 3.60GHz Memory: 1.46 GB / 3.84 GB Container: Yes Shell: 5.0.17 - /bin/bash Binaries: Node: 14.17.5 - ~/.nix-profile/bin/node Yarn: 1.22.0 - ~/.nix-profile/bin/yarn npm: 6.14.14 - ~/.nix-profile/bin/npm
What are the steps to reproduce?
Running the sample code will produce an heif image that is corrupted.
What is the expected behaviour?
An heif image that can be opened normally.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
#!/usr/bin/env node
'use strict'
const sharp = require('sharp')
async function resizeImage () {
try {
await sharp('elephant.png')
.resize({
width : 1000,
height : 1000,
background: { r: '255', g: '255', b: '255', alpha: '0' },
})
.toFormat('heif')
.toFile('wow-resized.heif')
} catch (error) {
console.log(error)
}
}
resizeImage()
Please provide sample image(s) that help explain this problem
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (4 by maintainers)
Interestingly https://www.checkfiletype.com/ can render a preview of the heif image
I have the same Issue. What have you done to fix it?