Latest 1.0.1
License MIT
Platforms ios 7.0, requires ARC

Image loading + background transforming.


  • Transform downloaded images in the background before displaying
  • Persistent caching
  • Preloading
  • iOS 7.0+
  • Documented
  • Nullability annotated
  • UIImageView (prefixed) category

Demo images are taken from the Flickr public feed.


Want to resize and round a downloaded image, which originally is huge and square? Sometimes it’s ok to do that via CALayer or so, but it could decrease performance of e.g. UICollectionView. So LiquorImage helps to transform downloaded images in the background:

Each UICollectionView cell contains two different versions of the same (corresponding) image: blurred one as a background and resized & rounded in the foreground:


// ForegroundImageBuilder.m //

@implementation ForegroundImageBuilder

- (UIImage *)imageFromData:(NSData *)data error:(NSError *__autoreleasing  _Nullable *)error {
    UIImage *image = [[LQDefaultImageBuilder shared] imageFromData:data error:error];
    if (image) {
        image = [image roundedCornerImage:15 borderSize:0];
    return image;


// Cell.m //


- (void)displayImage:(FlickrImage *)image {

    self.thumbImageTask = ({
        LQImageLoaderTask *task = [[LQImageLoaderTask alloc] initWithURL:url];
        // setting ForegroundImageBuilder
        [task setImageBuilder:[ForegroundImageBuilder new] withMemoryCacheIdentifier:@"thumb"];
        task.delegate = self;

    self.backgroundImageTask = ({
        LQImageLoaderTask *task = [[LQImageLoaderTask alloc] initWithURL:url];
        CGSize imageSize = self.backgroundImageView.bounds.size;
        // block-based image builder with blurring
        id<LQImageBuilding> builder = [[LQBlockImageBuilder alloc] initWithBlock:^UIImage * _Nullable(NSData * _Nonnull data, NSError *__autoreleasing  _Nullable * _Nonnull error) {
            UIImage *image = [[LQDefaultImageBuilder shared] imageFromData:data error:error];
            image = [image resizedImage:imageSize interpolationQuality:kCGInterpolationDefault];
            image = [image applyDarkEffect];
            return image;
        [task setImageBuilder:builder withMemoryCacheIdentifier:@"bg"];
        task.delegate = self;

    // start tasks
    [[LQImageLoader shared] startTask:self.thumbImageTask];
    [[LQImageLoader shared] startTask:self.backgroundImageTask];



Preload images and optionally represent the progress before displaying a collection view:

Preloading demo

[[LQImageLoader shared] preloadImageURLs:preloads withProgress:^(LQImageLoaderPreloadingContext * _Nonnull context) {
    textLabel.text = [NSString stringWithFormat:@"Preloading:nn%lu / %lu", (unsigned long)context.completedCount, (unsigned long)context.totalCount];
} completion:^(LQImageLoaderPreloadingContext * _Nonnull context) {

Persistent Caching

The loader uses HTTP response cache info by default, but you can control the max-age of an image via HTTPCache:

[[LQImageLoader shared].HTTPCache setURL:url maxAgeInSeconds:1000];

Latest podspec

    "name": "LiquorImage",
    "version": "1.0.1",
    "summary": "Image downloading, caching, preloading and background transforming. UIImageView category (prefixed) included.",
    "description": "Image downloading, persistent & in-memory caching, preloading and background transforming. UIImageView category (prefixed) included.",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "homepage": "",
    "authors": "Andrew Pleshkov",
    "social_media_url": "",
    "platforms": {
        "ios": "7.0"
    "source": {
        "git": "",
        "tag": "1.0.1"
    "source_files": "LiquorImage/**/*.{h,m}",
    "requires_arc": true

Pin It on Pinterest

Share This