luisespinoza / lecolorpicker Goto Github PK
View Code? Open in Web Editor NEWA Cocoa-Touch system for iOS to get a color scheme in function of an image, like iTunes 11 does.
License: Other
A Cocoa-Touch system for iOS to get a color scheme in function of an image, like iTunes 11 does.
License: Other
This is crashing our app at start up.
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x180b4bab8)
i'm getting crashes from LEColorPicker. it happens not that often, but still annoying.
Any ideas? thanks.
libdispatch.dylib 0x3b73eab0 _dispatch_xref_dispose$VARIANT$up + 8
TestApp 0x00101f57 -[LEColorPicker .cxx_destruct] (LEColorPicker.m:21)
libobjc.A.dylib 0x3b259c19 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 129
libobjc.A.dylib 0x3b256c37 objc_destructInstance + 35
libobjc.A.dylib 0x3b256e0b object_dispose + 15
TestApp 0x00101eb3 -[LEColorPicker dealloc] (LEColorPicker.m:851)
libobjc.A.dylib 0x3b265b0b _ZN11objc_object17sidetable_releaseEb + 175
I would like to use this in another open source component I'm working on. I really don't feel that the version that is available from CocoaPods is ready for production (lots of extra NSLog
s, dictionary for colors, etc.
I was looking at forking and making some changes but noticed you have been doing some more recent development in other branches but couldn't necessarily tell where I might could help out. Is there any way I could help out in my free time in getting this into a state that I could use it in a production open-source component?
I was also looking into panicinc/ColorArt, but the output from their algorithm doesn't seem to do as well for the specific use-case of images that I'm looking to process (app store icons).
Some changes I was hoping to make to make at the very least for my specific application:
NSLog
statementsThis is just a courtesy question asking what your plans are for this project so that when I do fork it for my own use that I don't squash any plans you may have had for the final architecture of this so that I might merge my changes back upstream.
When you try run the color picker while the app is backgrounded, a gpus_ReturnNotPermittedKillClient gets thrown, which is when OpenGL actions are triggered while an app is backgrounded.
I was playing with this today and I'm seeing an unexpected result with pickColorsFromImage:
method. It's always returning a background color of 0.235294 0.278431 0.27451
regardless of the image I pass in. An example of the code I'm doing:
[LEColorPicker pickColorFromImage:[UIImage imageNamed:@"img_header.png"] onComplete:^(NSDictionary *colorsPickedDictionary) {
topView.backgroundColor = [colorsPickedDictionary objectForKey:@"BackgroundColor"];
}];
I've tried many different img_headers, but I keep getting this same gray/green color. Am I using this incorrectly?
Hi, i use this awesome library in a uitableviewcell so every cell have to calculate the colors to pick.
it may be slow, can i use multiple thread for doing this ? you have any advice for me ?
Thanks very much your help is very appreciated :)
code below:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSArray *details = [[self.questions objectAtIndex:indexPath.row] componentsSeparatedByString:@"@_@"];
NSString *summary = [details objectAtIndex:1];
NSString *nickname = [details objectAtIndex:2];
NSString *img_avatar_string = [details objectAtIndex:4];
NSString *answers = [details objectAtIndex:7];
static NSString *CellIdentifier = @"Cell";
TDBadgedCell *cell = [[TDBadgedCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
NSString *img_url = [[NSString alloc] initWithFormat:@"http://XXXX.XXX/%@",img_avatar_string];
[cell.imageView setImageWithURL:[NSURL URLWithString:img_url]
placeholderImage:[UIImage imageNamed:@"loading_image.png"]];
if ([[details objectAtIndex:8] isEqualToString:@"1"]){
[LEColorPicker pickColorFromImage:cell.imageView.image onComplete:^(NSDictionary *colorsPickedDictionary) {
[UIView beginAnimations:@"ColorChange" context:nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.5];
cell.backgroundColor = [colorsPickedDictionary objectForKey:@"BackgroundColor"];
cell.textLabel.textColor = [colorsPickedDictionary objectForKey:@"PrimaryTextColor"];
cell.detailTextLabel.textColor = [colorsPickedDictionary objectForKey:@"SecondaryTextColor"];
cell.badgeColor = [colorsPickedDictionary objectForKey:@"PrimaryTextColor"];
cell.badgeTextColor = [colorsPickedDictionary objectForKey:@"SecondaryTextColor"];
[UIView commitAnimations];
}];
}
cell.badgeString = answers;
if ([summary length] > 20) {
cell.textLabel.text = [NSString stringWithFormat:@"%@...",[summary substringWithRange:NSMakeRange(0, 20)]];
}else{cell.textLabel.text = summary;}
cell.detailTextLabel.text = nickname;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//cell.showShadow = YES;
return cell;
}
I've noticed if my app resumes from the background it seems like LEColorPicker fails to get a color and simply returns nil. I'm going to try using the block method to see if that fixes the issue.
This didn't seem to be a problem in the commits around February, but now there is a pretty huge problem with the contrast between the text colors and the background color.
Here are some examples. Title/controls are PrimaryTextColor, album/artist are SecondaryTextColor:
Also note specifically in Dr. Dre's 2001 and Immortal Technique's Peruvian Cocaine, BackgroundColor should be #000000 and #FFFFFF respectively, but it seems like you just took the average color of the entire image instead of just sampling the edges. It's kind of hard to tell, but the BackgroundColor of 2001 is actually a very dark green.
Also note how the first image is basically completely black, and the text colors don't default to something like white.
Also, these are just extraneous circumstances, most of the colors that get picked are REALLY good. Props.
I'll try and see if I can do anything about this on my end, but I thought I should let you know :)
Does LEColorPicker ignore the border of an image? If not, can it be modified to do so?
I don't know if many others here use CocoaPods, but I'd definitely like it if LEColorPicker could be declared as a CocoaPod dependency. This would probably requires splitting this repo between the main lib and the example application, although I'm not sure about that.
What do you think ? I could probably look into that if @luisespinoza agrees and nobody else has more competency on that matter than I do (and for the records, I have none :P)
colorSchemeFromImage seems to require that the App is Active, but I fail to see why ?
In my very simple test of your nice library, I wanted to customize labels colors in the first view so I'm calling your library in viewDidLoad. Seems that my app wasn't already active and it returned nil.
Bypassing the test seems to give a correct non-crashing behavior.
Am I missing something ?
Thank you very much for your time :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.