I have a Cloud Function that resizes an image uploaded to Cloud Storage using Sharp. Everything works, but I'm trying to find a way for Sharp to include metadata of the exact height and width of the new image. I could make a new function that uses other npm packages to download the image from the url and get what I want, but I'm curious to know if there is a way for Sharp to do that as well?
Asked
Active
Viewed 1,659 times
1 Answers
3
just include "withMetadata()"
sharp('input.jpg')
.withMetadata()
.toFile('output-with-metadata.jpg')
.then(info => { ... });
you can find the documentation here https://sharp.pixelplumbing.com/api-output#withmetadata

Shiyas
- 570
- 5
- 11
-
Perfect! Not sure how I missed this from the docs but it's what I need, thanks! – Will Hlas Aug 18 '20 at 20:06