inatu
inatu

Reputation: 283

CIConstantColorGenerator CIFilter failed with error in Playground with Swift 2.0

I tried to create a color filter with the following line of code

let parameters = [kCIInputColorKey: CIColor(string: "0.5 0.7 0.3 1.0")]
let colorFilter = CIFilter(name: "CIConstantColorGenerator",    withInputParameters: parameters)
colorFilter?.outputImage

but the debug console output the rolling info

 <Error>: CGImageProviderCreate: invalid image provider size: 1.79769e+308 x 1.79769e+308.
<Error>: CGImageCreate: invalid image width.
<Error>: ImageIO: CGImageDestinationFinalize image destination must have at least one image
CGImageDestinationFinalize failed for output type 'public.tiff'

Thanks, plus: I tried to write this code in Swift Project, it works fine, but when worked in playground, just showed this error

Upvotes: 2

Views: 988

Answers (1)

kas-kad
kas-kad

Reputation: 3764

Just try to clarify what size of output image you want to get: colorFilter?.outputImage?.imageByCroppingToRect(CGRectMake(0, 0, 200, 200))

Upvotes: 5

Related Questions