Quick answer
If the message says file too large, maximum size exceeded, or image must be under a certain KB value, compress the image to that exact target first.
If the upload still fails after compression, the problem may be dimensions. Many portals require both a small file size and a specific width or height range.
What usually works best
Format matters too. Photos usually work best as JPG, while signatures, screenshots, transparent images, and interface graphics may work better as PNG. WebP is useful for modern websites, but older portals may not accept it.
For passport, visa, and exam photos, check the rules carefully before over-compressing. These portals often care about face visibility, background, dimensions, and format, not just KB size.
If it still fails
A reliable workflow is to compress to the stated KB limit, check the final dimensions, switch format only if needed, and upload again with one change at a time.