Shrinking camera image before Upload to server?

Hi.

We can use our vaadin 14 app on phones. It can use the camera to upload image, but of course it is typically quite big.

We can and do shrink images when they arrive on the server but it would be nice to do on the phone before sending to reduce bandwidth.

In “cookbook.vaadin.com/camera” example there is a comment about compressing the image, but it does not say how.

Is there an easy way to shrink images in the browser before sending?

I am from Swing background, so I am pretty poor at Javascript etc. I did see JS examples, but it is not clear how to apply them to V14.

Any guidance much appreciated.

Thx. Damian.