Usually yes. If quality alone is not enough, the photo is also made smaller in pixels until it fits.
Passport photos and signatures stay clear at 20–50 KB. Very large photos lose more detail at small limits.
JPG gives the smallest files for photos, and most forms accept it.