Lightbox adapt height

How to set the adeptive height to lightbox images? I tried to use a lightbox gallery but some image needs to scroll.
Thank you

The lightbox will always size to the dimensions of the target image. If it’s a particularly large image it can create an overly large lightbox. Reduce the physical size of your image. This can happen on portrait images in particular, so pay special attention to the dimensions. I aim for an image size of no more than 2000 px on the longest side.