Does Twitter transforms (scales) images uploaded with upload_with_media?


I have been testing the endpoint POST statuses/update_with_media with several images that exceed the limits required by the endpoint GET help/configuration:

"photo_size_limit": 3145728,
"photo_sizes": {
"large": {
            "h": 2048,
            "resize": "fit",
            "w": 1024

Images that exceed this limit are properly rejected.

But images just below the limit are displayed in my timeline with lower quality than what I submitted. In one case, for instance, the uploaded image is 1024x1521 px, 2 MB, 299 dpi, and when published it is about 600x891 px, 733 KB, 72 dpi.

Does this endpoint enforces some rules that limit the quality and size of the images uploaded, even if they comply with help/configuration limits? If so, which algorithm is used?