Hacker News new | past | comments | ask | show | jobs | submit login

Are you changing the code, or is it nondeterministic? I just reloaded and the last three pictures (cat, car, peacock) all had their vibrant color change.

Edit: Interestingly, it looks like it may sample the image at its visible size and not the full source image. If I resize my browser, triggering various media queries and thus image sizes, the dominant colors change after reloading.




Interesting, you're right! For me, the image of the bird (4th one) shows the most variation. The cat changes a bit too; the others seems relatively stable.

At first I thought it would be the same, since the percentage of each color should be roughly equivalent; but then again, the images themselves are being resampled on resize, so there may be individual pixel colors in one size image that aren't in another.

Still, though, the point of a proper resampling algorithm is to maintain the same general perceived appearance of the image at different sizes; assuming it is doing this well, you should expect to see the same dominant colors.

Of course, the algorithm also might just be sampling every nth pixel, which would mean a different sample group depending on the size.


Looking at every pixel of the image is quite slow (especially if you need to process multiple images, and more so when you're dealing with old devices, such as iPad 2). Resizing them is often "good enough" for the majority of use cases.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: