Josh Kahane
Josh Kahane

Reputation: 17159

Compressing UIImage as Far as Possible?

I am trying to compress down a selected UIImage as far as reasonably possible. I am currently compressing it like so:

UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
    NSData *imageData = [[NSData alloc] initWithData:UIImageJPEGRepresentation((image), 0.1)];

According to the length of the data, they come in anywhere between 250kb and 600kb depending on the photo selected. Maximising on storage is essential for me.

How would you suggest I might compress the photos down a little further? This is the only method I know of.

Thanks.

Upvotes: 1

Views: 885

Answers (2)

user529543
user529543

Reputation:

There is a web page where is a nice chart regarding the quality and file size.

enter image description here

JPEG is a compression with data loosing algorythm. If for you doesn't matter the quality change the color palette to 256 or even 8 color ( grayscale) and after that use the maxed compression.

Upvotes: 3

Patrick Tescher
Patrick Tescher

Reputation: 3447

You should probably grab a smaller version of the image. See this question for a good example of how to resize a UIImage. How to scale down a UIImage and make it crispy / sharp at the same time instead of blurry?

Upvotes: 1

Related Questions