我正在将一些图像导入我的应用程序,并在编辑后稍后将其导出。 UIImage的大小似乎大于原始数据。
getS1I1_indirect ssiClosure = show(getS1 ssiClosure) ++ ", " ++ show(getI1 ssiClosure)
• Couldn't match type ‘[Char]’ with ‘Int’
Expected type: ([Char] -> [Char] -> Int -> Int) -> Int
Actual type: ([Char] -> [Char] -> Int -> [Char]) -> [Char]
• In the first argument of ‘getI1’, namely ‘ssiClosure’
In the first argument of ‘show’, namely ‘(getI1 ssiClosure)’
In the second argument of ‘(++)’, namely ‘show (getI1 ssiClosure)’
let imageData = myData
print("Imge size at import: \(imageData.count)")
print("Imge size at import JPGRepresentation: \(UIImageJPEGRepresentation(UIImage(data: imageData)!, 1)!.count)")
print("Imge size at import PNGRepresentation: \(UIImagePNGRepresentation(UIImage(data: imageData)!)!.count)")
根据其他答案,这似乎是正常的: imageWithData image size become bigger?
现在的问题是:是否可以在不损失质量的情况下获取大小为Imge size at import: 88174
Imge size at import JPGRepresentation: 185973
Imge size at import PNGRepresentation: 425187
的数据?如果使用88174
,我会失去质量。
重新格式化:是否可以解压缩和压缩质量和尺寸相同的JPG图像?