A Swift library that provides an easy-to-use function to convert UIImage objects into CVPixelBuffer. This is useful for image processing tasks, such as feeding images into Core ML models.
- Converts UIImage to CVPixelBuffer.
- Simple and straightforward API.
- For iOS 15.0 and later.
- iOS: 15.0 or later
- Swift: 6.0 or later
To add ConvertTOCVPixelBuffer to your project:
- In Xcode, go to File > Add Packages.
- Paste the following repository URL into the search bar:
https://github.com/OKKHALIL3/ConvertTOCVPixelBuffer - Select the package and click Add Package.
Once added to your project, import the library in your Swift file:
import ConvertUIImage
if let pixelBuffer = convertImageToPixelBuffer(image: yourImage ?? backupImage, imageWidth: width, imageHeight: height) {
//your code
}