question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resizing HEIC issue

See original GitHub issue

Are 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:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, Oct 13, 2021

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.

0reactions
vulcaryncommented, Oct 13, 2021

Thanks for the answer and the help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert HEIC to JPEG - Resizing.app
Convert your images from HEIC to JPEG online and for free with no registration ... Resizing.app lets you convert or even resize your...
Read more >
How to Resize HEIC images with Pixillion Image Converter ...
Under the Resize tab, choose how you would like to resize your HEIC image. You can scale your image to resize it by...
Read more >
Image resizer: support HEIC photos · Issue #20058 - GitHub
Image Resizer seems like the perfect tool but it does not seem to recognize .HEIC files. Windows can preview thumbnails and Windows Photos ......
Read more >
How to reduce file size of HEIC image on iPhone 12 Pro Max
The only way to reduce the size is to downsize the image or lower its resolution. There are photo editors that will do...
Read more >
Compress HEIC | Reduce HEIC Image File Size Online
Online HEIC compressor lets you reduce HEIC image size for free. Select output file size or quality to get the best compression and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found