Get Updates By E-mail 

Article Written By:
Johann Dowa

iOS Library For Automatically Generating A Color Scheme From An Image Like iTunes 11

  •  
  •  
  •  
  •  
  •  

One of the interesting features in iTunes 11 is how the color scheme changes when looking at the details for an album based on that album cover.

There’s been a lot of talk about how exactly to do this, and here’s a library you can use in your iOS apps to easily gather a color scheme based on an image. Luis Espinoza has put together a library based on these discussions called LEColorPicker automatically generates a color scheme containing 3 colors.

Here’s an image from the readme showing the library at work on a couple of images:

LEColorPicker

 

After processing an image you can easily access the background, primary and secondary colors:

#import "LEColorPicker.h"
...
[LEColorPicker pickColorFromImage:image onComplete:^(NSDictionary *colorsPickedDictionary) {
_outputView.backgroundColor = [colorsPickedDictionary objectForKey:@"BackgroundColor"];
_titleTextField.textColor = [colorsPickedDictionary objectForKey:@"PrimaryTextColor"];
_bodyTextField.textColor = [colorsPickedDictionary objectForKey:@"SecondaryTextColor"];
}];
...

You can find LEColorPicker on Github here.

You can find the original question/answer thread explaining the algorithm over at StackOverflow.

Not completely identical to iTunes 11 color picking, but still does a great job.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments