The "Optimize gallery" dialog now offers two additional sorting options: "Size ascending" and "Size descending."
With these options, the files contained in the gallery can be specifically sorted by their actual file size (e.g., in kilobytes or megabytes). When sorting ascending, the smallest files are displayed first. When sorting descending, the largest files are shown first accordingly.
Important note: The important factor is only the storage size of the file on the data storage, not the image dimensions in pixels. E.g., an image with high resolution may have a smaller file size than an image with lower resolution if it is more heavily compressed.