The Centre Takes It
Apply online, then attend in person.
A UK visa application has no photo upload. You complete the application online, pay, and book an appointment at a visa application centre, where your fingerprints and a facial image are captured on the spot as part of proving your identity.
The centres are run by commercial partners under contract — Gerry's in Pakistan, VFS Global and TLScontact elsewhere. Whichever operator you deal with, the photograph is theirs to take, not yours to bring.
This page used to describe a 35x45mm photo with a light grey background, because it shared its guidance with the UK passport route. That was wrong for anyone applying for a visa, and it has been separated out.