Thursday, February 22, 2024
HomeiOS Developmentios - Can somebody assist me with my trimming to picture width...

ios – Can somebody assist me with my trimming to picture width operate? It is a Kind Ambiguous Error


I am receiving the error

Kind of expression is ambiguous with out extra context Swift

let widthDifference = CGFloat((picture?.cgImage!.width)!) - body!.width

let bitMapInfo = CGBitmapInfo(rawValue: (picture?.cgImage?.bitmapInfo.rawValue)!)

let intent = CGColorRenderingIntent(rawValue: (picture?.cgImage?.renderingIntent.rawValue)!)

// I am getting an error right here when creating the brand new cg rect.
let newCGImage: CGImage = CGImage(width: body?.width, top: picture?.cgImage?.top - widthDifference, bitsPerComponent: picture?.cgImage?.bitsPerComponent, bitsPerPixel: 72, bytesPerRow: picture?.cgImage?.bytesPerRow, area: (picture?.cgImage?.colorSpace)!, bitmapInfo: bitMapInfo, supplier: (picture?.cgImage?.dataProvider)!, decode: picture?.cgImage?.decode!, shouldInterpolate: false, intent: intent!)

let newCroppedCGImage = newCGImage.cropping(to: body!)!

let img = UIImage(cgImage: newCroppedCGImage)

I googled round however actually i am unable to discover any comparable points to clarify the error.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments