Code Monkey home page Code Monkey logo

imagebutter's Introduction

ImageButter

Image viewer for iOS that supports WebP. What is WebP? Find out more here.

You can find more about why we created this here.

Features

  • Animated WebP images support
  • Remote fetching and caching
  • Avoids duplicated requests
  • Async decoding
  • Loading/progress view
  • Animated GIFs
  • PNG/JPG/other standard iOS formats

Example

WebPImageView *imgView = [[WebPImageView alloc] initWithFrame:CGRectMake(0, 30, 300, 300)];
[self.view addSubview:imgView];
imgView.url = [NSURL URLWithString:@"https://yourUrl/[email protected]"];

//load from disk
//NSString *path = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"randomImage.webp"];
//imgView.url = [NSURL fileURLWithPath:path];

//add the loading View.
WebPLoadingView *loadingView = [[WebPLoadingView alloc] init];
loadingView.lineColor = [UIColor orangeColor];
loadingView.lineWidth = 8;
//add the loading view to the imageView.
imgView.loadingView = loadingView;
//if you want to add some inset on the image.
CGFloat pad = 20;
imgView.loadingInset = UIEdgeInsetsMake(pad, pad, pad*2, pad*2);

That will fetch the image, cache it, and decoding it all asynchronously. It will show a progress view showing the total download and display time. The can see the value of it being a WebP image here:

graph

Requirements

ImageButter requires at least iOS 7 or above. Dependencies are ImageIO, MobileCoreServices, CoreGraphics, and CommonCrypto.

Installation

CocoaPods

Check out Get Started tab on cocoapods.org.

Install CocoaPods if not already available:

$ [sudo] gem install cocoapods
$ pod setup

To use ImageButter in your project add the following 'Podfile' to your project

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
pod 'ImageButter'

Then run:

pod install

Tests

One of our TODOs. We would mighty appreciate any PRs in this department.

License

ImageButter is Copyright (c)2016, Dollar Shave Club, INC. It is free software, and may be redistributed under the terms specified in the LICENSE file (MIT License).

Contact

Dollar Shave Club

Dalton Cherry

imagebutter's People

Contributors

acmacalister avatar chrisbrandow avatar daltoniam avatar hlfcoding avatar orta avatar perishabledave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagebutter's Issues

App thinning with webp?

Hi,

I've observed a 35% decrease across all the images served with my app from the App Store when I switch from png to webp. However, I can't see a way to get app thinning to work. Xcode doesn't allow thinning by scale for data assets, and they don't allow .webp files in image assets. Is there any way to work around this? Thanks.

Port to Swift

We would like to create a version in Swift. Not sure if that will be another library or just convert this one.

Use CADisplayLink

We still need to do some profile and testing to see what this would gain us, but the docs would suggest it would be higher performance to use CADisplayLink versus the current GCD and drawRect: implementation.

Improvement request: document how to reduce images by 90%

As part of getting people to leverage WebP for their app, it would be great to see how to get the 90% reduction that is discussed in http://engineering.dollarshaveclub.com/shaving-our-image-size/. I tried an images with the -lossless flag, and I didn't get that 90% reduction, so then I tried lossy with -q 90 and got an even larger image! Here's the image I used:

preview_tool_accessory_background 3x

Perhaps I'm not using the correct flags? Or perhaps the dollar shave club wasn't compressing pngs as far as they could? Any suggestions would be greatly appreciated, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.