How this tool decides the result
A JPEG file gets smaller as quality goes down. This tool first looks for the highest quality that still fits your limit at the original dimensions. If even the lowest acceptable quality (around 50) is not enough, it shrinks the dimensions only as much as needed, then searches for quality again.
The result is an image with the highest possible quality that stays within the limit. If the original photo is already under the limit, the original file is used as it is, unchanged.