Is it possible to determine image dimensions with Starlark?

I’m working on an app that loads images via an API and that API does not return the image width and height as part of the payload. Is it possible using Starlark to determine the size of the image?

Alternatively, is it possible to set only the height of an image and have the width automatically resize proportionally?