Get size of a UIImage (bytes length) not height and width

后端 未结 10 2077
说谎
说谎 2020-11-28 09:00

I\'m trying to get the length of a UIImage. Not the width or height of the image, but the size of the data.

10条回答
  •  粉色の甜心
    2020-11-28 09:29

    SWIFT 4+

    let imgData = image?.jpegData(compressionQuality: 1.0)
    debugPrint("Size of Image: \(imgData!.count) bytes")
    

    you can use this trick to find out image size.

提交回复
热议问题