I am trying to display a JPEG image as it downloads, using part of the data, similiar to many web browsers do, or the facebook app.

there is a low-quality version of the image(just part of the data) and then display the full image in full quality.

this is best shown in the [VIDEO HERE](http://blog.patrickmeenan.com/2013/06/progressive-jpegs-ftw.html)

I followed this SO question:

[How do I display a progressive JPEG in an UIImageView while it is being downloaded?](https://stackoverflow.com/questions/4741486/how-do-i-display-a-progressive-jpeg-in-an-uiimageview-while-it-is-being-download)

but all I got was a imageview that is being rendered as data keeps comes in, no low-quality version first, no true progressive download and render.

can anyone share a code snippet or point me to where I can find more info as to how this can be implemented in an iOS app ?

tried this link for example which shows JPEG info, it identifies the image as progressive

<http://www.webpagetest.org/jpeginfo/jpeginfo.php?url=http://cetus.sakura.ne.jp/softlab/software/spibench/pic_22p.jpg>

and I used the correct code sequence

```
-(void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data
{
    /// Append the data
    [_dataTemp appendData:data];

    /// Get the total bytes downloaded
    const NSUInteger totalSize = [_dataTemp length];
    /// Update the data source, we must pass ALL the data, not just the new bytes
    CGImageSourceUpdateData(_imageSource, (CFDataRef)_dataTemp, (totalSize == _expectedSize) ? true : false);

    /// We know the expected size of the image
    if (_fullHeight > 0 && _fullWidth > 0)
    {
            [_imageView setImage:[UIImage imageWithCGImage:image]];
            CGImageRelease(image);
    }
}

```

but the code only shows the image when it is finished loading, with other images, it will show it as it downloading, but only top to bottom, no low quality version and then progressively add detail as browsers do.

[DEMO PROJECT HERE](https://dl.dropboxusercontent.com/u/172026/progressiveJPEGdemo.zip)