Created
October 4, 2015 00:43
-
-
Save KentarouKanno/104314f177e7d50a9fbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let limitByte: Int = 1000000 | |
var compressionQuality: CGFloat = 1.0 | |
var data: NSData! | |
repeat { | |
data = UIImageJPEGRepresentation(images,compressionQuality) | |
print("Quality\((compressionQuality)) = \(data!.length)") | |
compressionQuality -= 0.1 | |
} while data?.length > limitByte |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment