在Swift中将UIImage转换为UInt8数组

在Swift中将UIImage转换为UInt8数组

本文介绍了在Swift中将UIImage转换为UInt8数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有!

我一直在对此进行大量研究,并且我已经将几种不同的解决方案集成到我的项目中,但它们似乎都没有工作。我目前的解决方案来自

Supported combinations of bitsPerComponent, bytesPerRow, colorspace and bitmapInfo can be found here: https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html#//apple_ref/doc/uid/TP30001066-CH203-BCIBHHBB

注意每像素32位(bpp) 每像素4个字节,您可以用它来计算 bytesPerRow

Note that 32 bits per pixel (bpp) is 4 bytes per pixel and you use it to calculate bytesPerRow

这篇关于在Swift中将UIImage转换为UInt8数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 17:59