Resizing HEIC issue
See original GitHub issueAre you using the latest version? Is the version currently in use as reported by npm ls sharp
the same as the latest version as reported by npm view sharp dist-tags.latest
? sharp 0.29.1 with globally installed livips 8.11.4
What are the steps to reproduce? Try to resize an HEIC file.
What is the expected behaviour? Get the file resized and readable.
Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?
const fs = require('fs');
const sharp = require('sharp');
const rstream = fs.createReadStream('./test.HEIC');
const outFile = './test-thumbnail.HEIC'
try {
fs.rmdirSync(outFile)
} catch (e) {}
const writeS = fs.createWriteStream(outFile);
const resizer = sharp().resize(200, 200, {fit: 'contain'});
rstream.pipe(resizer).pipe(writeS);
Are you able to provide a sample image that helps explain the problem? The image is zipped to preserve all metadata and original format. test.HEIC.zip
What is the output of running npx envinfo --binaries --system
?
System:
OS: macOS 11.6
CPU: (8) x64 Intel® Core™ i7-4770HQ CPU @ 2.20GHz
Memory: 501.48 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 12.14.0 - /usr/local/bin/node
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 2021.06.07.00 - /usr/local/bin/watchman
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Great, glad you got it working.
Whilst the compression can be determined from the input and set on the output, it’s a bit more complexity that 99% people won’t need, and those who do are able to set it.
The prebuilt binaries provide support for only AV1/AVIF, so that’s a sensible default.
In the future, if the HEIF container provides another useful compression that is not patent-encumbered, then I might consider the auto-compression selection based on input.
Thanks for the answer and the help.