I guess it has to do with the affine transform you apply to the image before you do the clampedToExtent():
As you can see, the output of the transform has non-integer extent. This probably creates a row of transparent pixels at the top of the image, that is then repeated when applying clampedToExtent().
To avoid this, you can calculate the scale factors for your transform separately for x and y to ensure that the resulting pixel size is integer.
Alternatively, you can apply the clamping before you apply the affine transform.
Topic:
Programming Languages
SubTopic:
Swift
Tags: