Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用PencilKit框架来捕获用户的绘图并保存它。
PencilKit
我想保存一个白色背景的用户输入图。图像应该是这样的,我的画布背景是白色的。
我使用UIImageapidrawing.image(from: bounds, scale: 1.0)并保存它。在保存图像时,我得到以下信息
UIImage
drawing.image(from: bounds, scale: 1.0)
似乎背景已被删除,尽管我希望保留它。我想稍后将图像转换为白色 = 255 和黑色 = 0 强度的像素值。
我如何用 Swift 做到这一点?
谢谢大家的指导和帮助。