Ackchyually…
That is usually media server dependent. (Most of) the clients just yeet the media at them (Blossom, NIP-96, etc) and the media server decides whether to compress or resize. That’s why some hosts offer paid plans that include larger / uncompressed uploading.