Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colors are differents between the PHP and the JS version of Color Thief #9

Closed
ksubileau opened this issue May 20, 2014 · 1 comment
Closed
Labels

Comments

@ksubileau
Copy link
Owner

With some images, the dominant color or palette could be very different from the original JS version.

For exemple, with the attached image, Color Thief PHP gives rgb(180, 164, 118) as dominant color (beige), while Color Thief JS gives rgb(30, 36, 19) (dark green), a more accurate color.

bug_camera_1500x1000

@ksubileau ksubileau added the bug label May 20, 2014
@ksubileau ksubileau added invalid and removed bug labels Jun 18, 2014
@ksubileau
Copy link
Owner Author

After further testing, it appears that the color returned by the original JS script depends on the on-screen size of the image (CSS width & height properties). The source image is resized by the browser, and then the resized image is used for the dominant color computation. But resizing causes the fusion of some pixels, and therefore some colors are mixed, so the final result is altered.

So it's not a bug of the PHP port ! If you change the CSS of the demo page of the original script so that the image is displayed at full resolution, you should always get the same result in both JS and PHP versions (a few minor differences are possible but it's not visible to the naked eye).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant