3

I'm aware that ImageIO supports incremental rendering of images, but I'm not sure if it supports rendering of progressive JPEGs, specifically, I'd like to be able to render a low fidelity image quickly as it's being downloaded, and eventually arrive at a sharp image.

I've tried sample projects which use ImageIO's incremental rendering - but when pointed at a progressive JPEG file they do not show an image until all the data has been downloaded.

  • 1
    possible duplicate http://stackoverflow.com/questions/4741486/how-do-i-display-a-progressive-jpeg-in-an-uiimaveview-while-it-is-being-download – maroux Apr 25 '13 at 20:34
  • also, [SDWebImage](https://github.com/rs/SDWebImage/) also supports progressive download. – maroux Apr 25 '13 at 20:34
  • Thanks -- that does work, though it does emit warnings from the console: : ImageIO: JPEG Corrupt JPEG data: premature end of data segment. Perhaps the 2nd example you mentioned, where ImageIO is used directly, avoids the warnings. – Brian Tunning Apr 25 '13 at 21:26

1 Answers1

1

There is now a small open-source library on top of libjpeg-turbo which allows decoding and displaying progressive JPEGs easily:

let imageView = CCBufferedImageView(frame: ...)
if let url = NSURL(string: "http://example.com/yolo.jpg") {
    imageView.load(url)
}

see https://github.com/contentful-labs/Concorde

NeoNacho
  • 680
  • 1
  • 5
  • 13