Can someone please explain the scale for me (0 to 1)? Which is the best quality/least, and how does that affect file size?
Asked
Active
Viewed 1,538 times
0
-
See http://stackoverflow.com/a/17475842/1271826 – Rob Jun 25 '15 at 02:51
1 Answers
1
About scale
The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality).

Leo
- 24,596
- 11
- 71
- 92
-
But 1.0 is rarely the best choice, it is usual to drop back a little, it is a compromise of quality to file size. – zaph Jun 25 '15 at 02:25
-
Or use PNG which offers lossless compression (and preserves transparencies). Or, even better, where possible, go back to the original asset used for creating the image (e.g. the `NSData` used with `imageWithData`, or if you retrieved it from photos/assets library, there is API to retrieve the original asset). Clearly, if you dynamically created image with `UIGraphicsGetImageFromCurrentImageContext`, then you have to use `UIImagePNGRepresentation` or `UIImageJPEGRepresentation`, but otherwise you're generally better served going back to original asset. – Rob Jun 25 '15 at 18:41