Scale images based on a container size to fit them based on gravity and zoom clipping using the container layout