How to get Photo dimensions after loading photo in capture-photo?

@khilda You can estimate the size of the attachment as described here. Based on my understanding of your needs, this should be sufficient, as it sounds like it is more a question of file size rather than actual image dimensions (although I realize the latter does influence the former)

As for getting the actual dimensions of the image, you may be able to use an NPM package to get the those, but your mileage may vary since you don’t have access to the file system (which is what most image manipulation “software packages” typically require). For a TS app, this should be pretty straight forward, but for a JS app you will need to use a custom HTML component and implement the NPM (or other JS library) using the HTML Bridge / iFrame.

PS. This looks promising since it seems to support Buffers as an input to synchronous implementation.

I hope this helps.

1 Like