When a gallery is displayed, the component works out the height of the tallest image in the gallery, and works out the width of the widest image.
The gallery then sets the width of the main image container to the widest width, and the height of the container to the tallest image in the gallery.
The component then injects each image inside the image container.
If you gallery has 10 images that are 400 pixels high, and one image that is 700 pixels high, then image container will get set to 700 pixels, and all the 400 pixel high images will have white space above and below them.
The gallery does not change the size of the main image container when the image size changes. If it did, the thumbnails/ descriptions/ content below the picture would jump up and down when the image changes, which is distracting.
You can adjust the image width/height or crop settings in the profile to get the images a more similar height.