Question

I am downloading a JPEG image from a server and assigning it to an image object in my iPhone app using an NSURLConnection.

All works fine when I'm on a Wifi connection, but as soon as I switch to 3G, the quality of the JPEG downloaded reduces dramatically.

Has anyone else experienced this?

Does anyone know of a way to force the iPhone to download the full quality JPEG?

Thanks in advance! Nick.

Was it helpful?

Solution

If it's the 3G provider that compresses data on the fly I don't think you can do anything about it. Download the image with Safari via 3G -> if the image looks bad (and I expect it will) then it's the provider that compresses it.

To workaround this problem zip the image on the server and unzip it in the application -> this should bypass the compression on the 3G side.

OTHER TIPS

A simple trick is to use https instead of http - this appears to work on O2.

I know this question is quite old but incase this is of any use to anyone...

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:theURL];
// Add headers to avoid mobile network operator image compression
[request setValue:@"no-cache" forHTTPHeaderField:@"Pragma"];
[request setValue:@"no-cache" forHTTPHeaderField:@"Cache-Control"];

Should stop the compression of images.

The mobile operator compresses images in order to save bandwidth, but they tend to respect these header fields, and allow you to request the uncompressed image.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top