'Why does PKDrawing to pngData return a scaled image

I am trying to export a PKDrawing as image like so

drawing.image(from: CGRect(x: 0, y: 0, width: 1042, height: 21000), scale: 2).pngData()

but the returned image has a width of 401 for some reason (while it should be 2048 because of the 2x scale).

Why is this happening and how to I export the image without automatic scaling?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source