Post

Replies

Boosts

Views

Activity

Reply to Crash at UIImage.draw function in Swift 5
A workaround I found is to first draw the image using a format that is opaque and uses a standard color range and then draw that new image in the PDF context. let image = ... // Re-draw image to adjust color range etc. let format = UIGraphicsImageRendererFormat.default() format.preferredRange = .standard format.opaque = true format.scale = 1 // non-retina let newImage = UIGraphicsImageRenderer(size: image.size, format: format).image { _ in image.draw(in: CGRect(origin: .zero, size: image.size)) } // Draw in PDF context newImage.draw(in: CGRect(origin: .zero, size: newImage.size))
Oct ’23