News for hackers. Stuff that matters.
Re:Gradify turns the most prominent colors in an image into ... by pmx on Sunday June 14, 2015 @02:24AM (#9713933)
Really nice effect - I can see this being used on galleries / profiles, etc. What is with the weird scroll behaviour on this page, though? It will refuse to stay where I put it and keeps jumping to odd snap points after a few seconds. Annoying.
Re:Gradify turns the most prominent colors in an image into ... by stephenr on Sunday June 14, 2015 @02:28AM (#9713938)
The hostile scrolling on the page makes it effectively unusable on mobile
Re:Gradify turns the most prominent colors in an image into ... by ourmandave on Sunday June 14, 2015 @10:58AM (#9715108)
This is why no one downloads the band Hostile Scrolling's app.
Re:Gradify turns the most prominent colors in an image into ... by SiVal on Sunday June 14, 2015 @05:54AM (#9714361)
Beautiful effect. Well done. (And I have no weird scrolling effects on either Firefox on laptop or Safari on phone, so maybe it was fixed.)
Re:Gradify turns the most prominent colors in an image into ... by brownbat on Sunday June 14, 2015 @07:05AM (#9714472)
I was just excited when I heard Paint will build a gradient if you shrink a two-tone image to a pixel width and re-expand:

http://www.instructables.com/id/Gradients-in-MIcrosoft-Paint...

Re:Gradify turns the most prominent colors in an image into ... by DanBC on Sunday June 14, 2015 @04:05AM (#9714139)
Do you have permissions to use those images?

https://m.flickr.com/#/photos/lightofthewild/5611692322/

The left margin is broken on Chrome on iOS. http://m.imgur.com/94fzJrc

The scrolling behaviour make the page impossible to use. The scrolling, and I say this as politely as I can, is fucking horrible and makes me want to smash my phone to little pieces.

Sorry for the negative tone. The actual thing looks cool. It'd be nice to see these gradients being used more often.

Re:Gradify turns the most prominent colors in an image into ... by kevinbowman on Sunday June 14, 2015 @06:22AM (#9714414)
> Do you have permissions to use those images?

Wow, you're quite right - there's no attribution on any of the photos. Also, since they're re-hosted onto tumblr it's hard to tell where they came from.

It's possible that the author may have taken all of the photos themself, but unlikely given the example which you've pointed out. It's also possible that the author has sought private permission to use the photos, but you'd probably expect some attribution if that were the case.

Re:Gradify turns the most prominent colors in an image into ... by logn on Sunday June 14, 2015 @10:49AM (#9715078)
I think it would fall under fair use. This is a demo for an open source project.
Re:Gradify turns the most prominent colors in an image into ... by gnud on Sunday June 14, 2015 @03:29PM (#9716039)
non-commercial use does not equal fair use.
Re:Gradify turns the most prominent colors in an image into ... by logicallee on Sunday June 14, 2015 @04:08AM (#9714150)
wow, nice save on this comment :)
Re:Gradify turns the most prominent colors in an image into ... by ionforce on Sunday June 14, 2015 @02:30AM (#9713942)
Why does the page keep jumping around?
Re:Gradify turns the most prominent colors in an image into ... by Keyframe on Sunday June 14, 2015 @10:04AM (#9714925)
You could blur the image as well. I have tried a similar approach with blur quite awhile ago: http://www.cssdesk.com/VYN67 Change the image URI to see it work on another image.
Re:Gradify turns the most prominent colors in an image into ... by coob on Sunday June 14, 2015 @10:16AM (#9714977)
The point with this method is that the gradient acts as a fill before the image is loaded.
Re:Gradify turns the most prominent colors in an image into ... by kuschku on Sunday June 14, 2015 @12:50PM (#9715515)
Which one could combine with blurring.

Progressive JPEG with a blur filter depending on how much has loaded yet?

That would be the best solution, probably.

Re:Gradify turns the most prominent colors in an image into ... by Keyframe on Sunday June 14, 2015 @01:43PM (#9715702)
It's an interesting idea to put into a JPEG decoder directly.
Re:Gradify turns the most prominent colors in an image into ... by Keyframe on Sunday June 14, 2015 @10:33AM (#9715040)
Ah, of course.
Re:Gradify turns the most prominent colors in an image into ... by CodeWriter23 on Sunday June 14, 2015 @05:21AM (#9714288)
Great idea!

Found a bug - it doesn't follow the "orientation" property of the image, resulting in photos and gradients that are rotated.

I don't do Python myself, but using PerlMagick, the fix is $magick->AutoOrient();

Re:Gradify turns the most prominent colors in an image into ... by the8472 on Sunday June 14, 2015 @11:14AM (#9715147)
that property is non-standard. Many viewers don't respect it. So calling it a bug is a bit much in my opinion. More of an RFE.
Re:Gradify turns the most prominent colors in an image into ... by throwaway56789 on Sunday June 14, 2015 @04:06AM (#9714142)
To fix the horrible scroll (never, ever interfere with the scroll functionality!!!) add this in the console / scratchpad etc.:

window.addEventListener("scroll", function(ev) { ev.stopPropagation(); }, true);

Re:Gradify turns the most prominent colors in an image into ... by maggit on Sunday June 14, 2015 @06:51AM (#9714456)
Is the author of this around? There's a rather prominent spelling mistake in the first sentence; it says "prominant" where it should say "prominent" :)
Re:Gradify turns the most prominent colors in an image into ... by dssddsds on Sunday June 14, 2015 @06:59AM (#9714464)
cheers for the heads up, spelling ain't my forte!
Re:Gradify turns the most prominent colors in an image into ... by Listen_up_buddy on Sunday June 14, 2015 @03:52AM (#9714114)
Pretty!

Fix the scroll highjacking please.

Re:Gradify turns the most prominent colors in an image into ... by mmahemoff on Sunday June 14, 2015 @06:10AM (#9714389)
Nice tool. Looking at devtools, it generates a gradient in each direction (left, right, top, bottom). Each of these gradients is a single color transitioning from fully-transparent to fully-opaque.

The algorithm looks to be breaking the image into the 4 quadrants and finding the dominant color in each quadrant (eliminating any shades that are too gray). e.g. to get the color for the left-to-right gradient, it finds the most dominant color on the right of the image.

Re:Gradify turns the most prominent colors in an image into ... by Theodores on Sunday June 14, 2015 @02:39AM (#9713963)
This is great for photos but not that useful with product images surrounded by white space as that white space becomes a colour.
Re:Gradify turns the most prominent colors in an image into ... by dssddsds on Sunday June 14, 2015 @02:46AM (#9713972)
actually has a minimum distance from white, white is accepted if there's literally nothing else
Re:Gradify turns the most prominent colors in an image into ... by ohitsdom on Sunday June 14, 2015 @12:38PM (#9715468)
Biggest site that uses this technique is pinterest. It's a pretty crucial UI "trick", especially over slow internet connections. A user's pinterest home page is mostly images, and if they didn't use this dominant color trick, the page would look awful until things loaded.
Re:Gradify turns the most prominent colors in an image into ... by the8472 on Sunday June 14, 2015 @07:14AM (#9714491)
> the 4 most common colors

maybe it would be better to weight pixels by the energy density of the image region so that backgrounds (sky, walls) don't dominate the resultant colors over the (usually more significant) foreground/detailed objects

Re:Gradify turns the most prominent colors in an image into ... by dssddsds on Sunday June 14, 2015 @07:20AM (#9714500)
I have a few todo improvements, but if you'd like to see this one tested/implemented, add as an issue on the github!
Re:Gradify turns the most prominent colors in an image into ... by franciscop on Sunday June 14, 2015 @05:50AM (#9714354)
I was going to implement this myself in the future as I need something similar. The main difference is that I thought of using an inline svg to have more flexibility in the way gradients look and are positioned.
Re:Gradify turns the most prominent colors in an image into ... by Moter8 on Sunday June 14, 2015 @03:30AM (#9714076)
Tried it out on an image that would be used on a realtor website. Doesn't look too good in my opinion.

http://i.imgur.com/WrbsRcM.png

Re:Gradify turns the most prominent colors in an image into ... by dssddsds on Sunday June 14, 2015 @03:42AM (#9714091)
the js version (that example) isn't as good as the py version
Re:Gradify turns the most prominent colors in an image into ... by frozenport on Sunday June 14, 2015 @02:33AM (#9713950)
Would using a really large order polynomial be any more help? For example a 10th order best fit?
Re:Gradify turns the most prominent colors in an image into ... by eru on Sunday June 14, 2015 @06:20AM (#9714408)
Larger order polynomials usually just give you more `swing'.
Re:Gradify turns the most prominent colors in an image into ... by rqk7sWvM on Sunday June 14, 2015 @04:31AM (#9714211)
Why don't you just post the 5 or 10 lines of code you're using to create the effect?
Re:Gradify turns the most prominent colors in an image into ... by chronial on Sunday June 14, 2015 @05:02AM (#9714252)
They are one click away and more like 200 lines:

https://github.com/fraser-hemp/gradify/blob/master/gradify.p...