Download and decode progressive JPEGs on iOS.

Related tags

Image Concorde
Overview

Concorde

Version License Platform Build Status Coverage Status

This is a framework for downloading and decoding progressive JPEGs easily on iOS and OS X. It uses libjpeg-turbo as underlying JPEG implementation. We vendor version 1.4.0 of the static library from libjpeg-turbo's official release for convenience.

Usage

Simply install it via CocoaPods:

pod 'Concorde'

and then use CCBufferedImageView which progressively downloads and shows an image:

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

If you use Contentful, install the subspec:

pod 'Concorde/Contentful'

and replace your usage of UIImageView with CCBufferedImageView to automatically use progressive JPEGs if you have been using the UIImageView category before. This will work regardless of the original format of your files due to the image transformation functionality of the delivery API.

Manual integration

You can also integrate Concorde as a subproject or download a binary build from the releases section. Please note that those are only provided for iOS at the moment.

License

Copyright (c) 2015 Contentful GmbH. See LICENSE for further details.

CCBufferedImageDecoder is derived from WebKit, see comments in its file for further copyright details.

The examples use http://pooyak.com/p/progjpeg/, which artificially slows the connection down to 0.5 Kilobyte/second to demonstrate the differences between regular and progressive JPEGs.

Comments
  • Swift 4 Compatibility - No NSURLConnection Refactor

    Swift 4 Compatibility - No NSURLConnection Refactor

    I did a little grunt work here converting the project to Swift 4 from Swift 2. There's still a warning regarding the deprecation of NSURLConnection. The CCBufferedImageView needs refactoring to be up to date with URLSession, but that's going to be a bigger effort.

    I figured the first step would be to make this repo easily compatible with Xcode 9 😛

    The tests all pass, I regenerated the reference images for the snapshot cases and they match the spec.

    opened by krze 7
  • Crash while loading jpeg

    Crash while loading jpeg

    Crashed: com.contentful.Concorde EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x00000000

    Thread : Crashed: com.contentful.Concorde
    0  libobjc.A.dylib                0x31e2af78 lookUpImpOrForward + 47
    1  libobjc.A.dylib                0x31e2af3f _class_lookupMethodAndLoadCache3 + 34
    2  libobjc.A.dylib                0x31e2af3f _class_lookupMethodAndLoadCache3 + 34
    3  libobjc.A.dylib                0x31e311f9 _objc_msgSend_uncached + 24
    4  Concorde                       0x001f7a64 _TFFC8Concorde19CCBufferedImageView10connectionFS0_FTCSo15NSURLConnection14didReceiveDataCSo6NSData_T_U_FT_T_ + 372
    5  libdispatch.dylib              0x3238540f _dispatch_client_callout + 22
    6  libdispatch.dylib              0x3238e861 _dispatch_barrier_sync_f_invoke + 48
    7  Concorde                       0x001f62a8 _TToFC8Concorde19CCBufferedImageView10connectionfS0_FTCSo15NSURLConnection14didReceiveDataCSo6NSData_T_ + 304
    8  CFNetwork                      0x2410aeed __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 56
    9  CFNetwork                      0x2410aea7 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 182
    10 CFNetwork                      0x2410af99 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 36
    11 CFNetwork                      0x240f8a11 _NSURLConnectionDidReceiveData(_CFURLConnection*, __CFData const*, long, void const*) + 80
    12 CFNetwork                      0x2401deab ___ZN27URLConnectionClient_Classic29_delegate_didReceiveDataArrayEv_block_invoke + 158
    13 CFNetwork                      0x240bc76d ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 60
    14 CFNetwork                      0x24010d71 RunloopBlockContext::_invoke_block(void const*, void*) + 60
    15 CoreFoundation                 0x244c35a1 CFArrayApplyFunction + 36
    16 CFNetwork                      0x24010c2b RunloopBlockContext::perform() + 182
    17 CFNetwork                      0x24010af1 MultiplexerSource::perform() + 216
    18 CFNetwork                      0x2401098d MultiplexerSource::_perform(void*) + 48
    19 CoreFoundation                 0x24578fd7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
    20 CoreFoundation                 0x245783eb __CFRunLoopDoSources0 + 222
    21 CoreFoundation                 0x24576a69 __CFRunLoopRun + 768
    22 CoreFoundation                 0x244c3b31 CFRunLoopRunSpecific + 476
    23 CoreFoundation                 0x244c3943 CFRunLoopRunInMode + 106
    24 GraphicsServices               0x2b8a1051 GSEventRunModal + 136
    25 UIKit                          0x27ab5f21 UIApplicationMain + 1440
    26 Chata de Galocha               0x00043e34 main (AppDelegate.swift:19)
    
    opened by puelocesar 7
  • Move swift code into subspec

    Move swift code into subspec

    Hi! We love your library! Very nice. The most interesting part in this project for me is the CCBufferedImageDecoder in pair with the library. In my eyes the CCBufferedImageView.swift is more like an example of how to integrate. Therefore I created this https://github.com/agens-no/CCBufferedImageDecoder

    Ideally for me we would just change the podspec in this repo to either a) move the swift stuff into a subspec or b) remove the swift stuff or c) use one of the [ports].(https://github.com/ljfantin/Concorde/blob/feature/support_ios_7/Code/CCBufferedImageView.m).

    Anyways, just though I should let you know.

    enhancement 
    opened by hfossli 6
  • CCDecodingStatusNextIteration

    CCDecodingStatusNextIteration

    Hello Boris!

    What does CCDecodingStatusNextIteration mean? Does it simply mean that there's isn't enough information to fill the whole canvas and given more data it probably will?

    opened by hfossli 2
  • Fixed crash caused by decodedImage in CCBufferedImageView being nil.

    Fixed crash caused by decodedImage in CCBufferedImageView being nil.

    I've noticed that occasionally I get a crash when using CCBufferedImageView with progressive JPEGs. The crash is an EXC_BAD_ACCESS on the decodedImage variable in public func connection(connection: NSURLConnection, didReceiveData data: NSData).

    This crash is quite easily reproducible if you place the CCBufferedImageView inside a tableview cell.

    Adding a guard to make sure that decodedImage is not nil solves the issue.

    opened by nmarisi 2
  • Freezes main thread

    Freezes main thread

    I have a tinder-like stack of images. Touch events are not delivered while big images gets loaded/decode. Thats because you decode image with dispatch_sync and it stops main_thread.

    opened by orkenstein 2
  • Fix test suite and update project to work with Swift 2.1 / Xcode 7.2

    Fix test suite and update project to work with Swift 2.1 / Xcode 7.2

    Currently blocked by "FBSnapshotTestCase" not building on 7.2 — "Use of private header from outside its module" for all imports of private headers in implementation (!) files.

    opened by neonichu 1
  • Update gem dependencies

    Update gem dependencies

    Updating the Gems in order to fix security vulnerabilities in dependencies. Also moving rubygems to HTTPS. Can you please run your tests and see if it all works?

    opened by felipecoe 0
  • Help~

    Help~

    I want to develop the component in Java.But I can't find detailed description of ProgressiveJpeg format when searching on Google.Please guide me where I can get detailed information about ProgressiveJpeg.

    opened by Fishbonelsy 2
  • Doesn't Progressively Download and Decode JPEGs on iOS.

    Doesn't Progressively Download and Decode JPEGs on iOS.

    The title of this github repository is "Download and decode progressive JPEGs on iOS." But it doesn't do the very thing that Progressive JPEG was invented to do:

    Progressively download and decode JPEGs on iOS

    It misuses NSURLSession to grab ALL the data (a process that takes 99% of the total time) then decodes it.

    Please rewrite to use NSURLSession in stream mode, so that is passed to your CGDataProvider in bursts, decoding what you can and writing it to the screen as the data comes in.

    In CCBufferedImageDecoder , you create your CGDataProvider with an NSData, but by the time you have the NSData, 99% of the time of fetching and displaying the image has already elapsed, making progressive jpeg decoding pointless.

    opened by DavidPhillipOster 2
  • Add support for bitcode

    Add support for bitcode

    When I try to include this in an iOS 9 project, I get errors about bitcode support not being available on a certain ARM architecture. As a result, I have to disable bitcode for my entire app.

    bug 
    opened by iheart2code 6
  • Grey Placeholders forever?

    Grey Placeholders forever?

    Hello!

    I have been trying to use Concorde in a iOS project with the following code:

    if let url = NSURL(string: produto.imagem!.url!){
            let imagem = CCBufferedImageView(frame: cell.imageView!.frame)
            imagem.load(url)
            cell.addSubview(imagem)
    }
    

    produto.imagem is a Contentful Asset and url value currently is: url NSURL "https://images.contentful.com/765kywdqo8as/1u0UQOzrSEyAIYoY8CgaiU/743112ca52714a9739b7550fb83a43e2/3479738_wallsPetroleum_01.png" 0x00007feba3861590

    When I execute my code I only get grey placeholders and never an image.

    On the other hand I have tried using ContentfulPersistence with the following code:

    let imagem = CCBufferedImageView(frame: cell.imageView!.frame)
    imagem.cda_setImageWithPersistedAsset(produto.imagem!, client: source!.client, size: imagem.frame.size, placeholderImage: nil)
    cell.addSubview(imagem)
    

    Then I get the following error: fatal error: should never be called: file /Users/rafael/Trabalho/Bier Leverpilsen/Pods/Concorde/Code/CCBufferedImageView+Contentful.swift, line 18

    Any help would be appreciated! I have been struggling for a while!

    opened by ghost 3
Releases(0.2.0)
Owner
Contentful Labs
Experimental unofficial projects for https://www.contentful.com
Contentful Labs
An image download extension of the image view written in Swift for iOS, tvOS and macOS.

Moa, an image downloader written in Swift for iOS, tvOS and macOS Moa is an image download library written in Swift. It allows to download and show an

Evgenii Neumerzhitckii 330 Sep 9, 2022
This simple cordova plugin will download picture from an URL and save to IOS Photo Gallery.

Photo Viewer This plugin is intended to download a picture from an URL into IOS Photo library.. How to Install Cordova: cordova plugin add https://git

Alwin jose 1 Oct 23, 2021
Download manager

Features Download manager Running in the background Loading multiple files You can cancel, pause, resume, reload Example UML Class Diagram General sch

Beslan Tularov 59 Dec 12, 2022
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.

I've built out the Swift version of this library! Screenshots Description ABMediaView can display images, videos, as well as now GIFs and Audio! It su

Andrew Boryk 80 Dec 20, 2022
An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and  Watch.

KFSwiftImageLoader KFSwiftImageLoader is an extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memor

Kiavash Faisali 343 Oct 29, 2022
APNGKit is a high performance framework for loading and displaying APNG images in iOS and macOS.

APNGKit is a high performance framework for loading and displaying APNG images in iOS and macOS. It's built on top of a modified version of libpng wit

Wei Wang 2.1k Dec 30, 2022
✂️ Detect and crop faces, barcodes and texts in image with iOS 11 Vision api.

ImageDetect ImageDetect is a library developed on Swift. With ImageDetect you can easily detect and crop faces, texts or barcodes in your image with i

Arthur Sahakyan 299 Dec 17, 2022
Backport of SwiftUI.AsyncImage to iOS 14, macOS 11, tvOS 14 and watchOS 7 and earlier.

SBPAsyncImage Backport of SwiftUI.AsyncImage to iOS 14, macOS 11, tvOS 14 and watchOS 7 and earlier. AsyncImage is a view that asynchronously loads an

Yutaro Muta 48 Dec 16, 2022
Jogendra 113 Nov 28, 2022
A simple iOS photo and video browser with grid view, captions and selections.

MWPhotoBrowser A simple iOS photo and video browser with optional grid view, captions and selections. MWPhotoBrowser can display one or more images or

Michael Waterfall 8.8k Dec 27, 2022
Twitter Image Pipeline is a robust and performant image loading and caching framework for iOS clients

Twitter Image Pipeline (a.k.a. TIP) Background The Twitter Image Pipeline is a streamlined framework for fetching and storing images in an application

Twitter 1.8k Dec 17, 2022
The first non-jailbroken iOS (and macOS) application to adjust the screen temperature, brightness, and color!

GoodNight Project name thanks to @Emu4iOS. Based off of Thomas Finch's GammaThingy. GoodNight is an app that allows you to directly access the screen'

Anthony Agatiello 558 Nov 3, 2022
FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor

FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor Quick demo Batch select/deselect Smoo

Cong Nguyen 648 Dec 27, 2022
🍁🥓 Lightweight and fast Swift library for image downloading, caching and transformations

MapleBacon Introduction MapleBacon is a lightweight and fast Swift library for downloading and caching images. Example The folder Example contains a s

Jan Gorman 335 Nov 1, 2022
Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer.

PassportScanner Works with 2 and 3 line identity documents. What is this With PassportScanner you can use your camera to scan the MRZ code of a passpo

Edwin Vermeer 441 Dec 24, 2022
A smart and easy-to-use image masking and cutout SDK for mobile apps.

TinyCrayon SDK for iOS A smart and easy-to-use image masking and cutout SDK for mobile apps. TinyCrayon SDK provides tools for adding image cutout and

null 1.8k Dec 30, 2022
Image viewer (or Lightbox) with support for local and remote videos and images

Table of Contents Features Focus Browse Rotation Zoom tvOS Setup Installation License Author Features Focus Select an image to enter into lightbox mod

Nes 534 Jan 3, 2023
Lightweight and customisable async image loading in SwiftUI. Supports on-disk storage, placeholders and more!

Asyncrounously download and display images in Swift UI. Supports progress indicators, placeholders and image transitions. RemoteImageView Asyncrounous

Callum Trounce 192 Dec 7, 2022
Photo Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more

IDMPhotoBrowser IDMPhotoBrowser is a new implementation based on MWPhotoBrowser. We've added both user experience and technical features inspired by F

Thiago Peres 2.7k Dec 21, 2022