How can I fix a Core Image's CILanczosScaleTransform filter border artifact?

前端 未结 1 439
悲哀的现实
悲哀的现实 2021-01-23 23:26

I want to implement an image downscaling algorithm for iOS. After reading that Core Images\'s CILanczosScaleTransform was a great fit for it, I implemented it the f

1条回答
  •  隐瞒了意图╮
    2021-01-23 23:39

    You can use imageByClampingToExtent.

    Calling this method ... creates an image of infinite extent by repeating pixel colors from the edges of the original image.

    You could use it like this:

    ...
    guard let ciImage = CIImage(image: image)?.clampedToExtent() else {
        fatalError("Couldn't create CIImage from image in input")
    }
    

    See more information here: Apple Doc for clampedtoextent

    0 讨论(0)
提交回复
热议问题