0
我有一個圖像(captureImage)這是由相機和調整大小。我使用UIImageJPEGRepresentation
來壓縮圖像,壓縮後圖像的大小增加。這是正常行爲還是我以錯誤的方式進行壓縮/調整大小?UIImageJPEGRepresentation增加UIImage大小
if let image = captureImage {
print(image.size) // (700, 700)
let compressedImageData = UIImageJPEGRepresentation(image, 0.3)!
let compressedImage = UIImage(data: compressedImageData)!
print(compressedImage.size) // (3024, 3024)
}
請參考吼叫鏈接: http://stackoverflow.com/questions/29137488/how-do-i-resize-the-uiimage-to-reduce-upload-image-size可能對你有幫助。 – Aashish1aug
您正在調整圖片大小:https://iosdevcenters.blogspot.com/2015/12/how-to-resize-image-in-swift-in-ios.html –