bugfix: change sorting to be deterministic

Sort by height, then by width, then by filename to ensure the
sorted results will always be the same between different runs.