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

[Web] different color detection on mobile browser vs desktop #51

Open
nandorojo opened this issue Apr 5, 2022 · 4 comments
Open

[Web] different color detection on mobile browser vs desktop #51

nandorojo opened this issue Apr 5, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@nandorojo
Copy link

Bug

Mobile browsers and desktop browsers return a different set of colors for the same image. I'm not sure if this is a bug with node-vibrant or this library's Web approach. My guess is it's node vibrant?

Take this image:

On a desktop browser, I get these colors, which seem relatively correct. They're essentially grays.

{
  "dominant": "#3c3c3c",
  "vibrant": "#7f7f7f",
  "darkVibrant": "#424242",
  "lightVibrant": "#bcbcbc",
  "darkMuted": "#3c3c3c",
  "lightMuted": "#acacac",
  "muted": "#7c7c7c",
  "platform": "web"
}

However, on a mobile browser (Chrome or Safari on iOS), I get these colors:

{
  "dominant": "#443c3e",
  "vibrant": "#3fbf7f",
  "darkVibrant": "#040c08",
  "lightVibrant": "#9bddbc",
  "darkMuted": "#443c3e",
  "lightMuted": "#b4bcb4",
  "muted": "#847c81",
  "platform": "web"
}

Environment info

Library Version
react-native-image-colors 1.5.0

Steps To Reproduce

  1. Use this image URL: https://res.cloudinary.com/dn29xlaeh/image/upload/q_75,w_640/v1/beatgig-live/quhilykqgarpqnf9peyk
  2. Get the colors on a mobile browser
  3. Get the colors on a desktop browser

Describe what you expected to happen:

  1. The colors on both platforms should be the same.

Reproducible sample code

Here is a reproducible snack: https://snack.expo.dev/@beatgig/thankful-almond?supportedPlatforms=web

These are the colors it comes up with on a desktop browser:

Screen Shot 2022-04-05 at 11 26 50 AM

Meanwhile, here it is on a mobile browser (you'll have to turn your phone sideways to see it on Snack)

IMG_6045

@nandorojo nandorojo added the bug Something isn't working label Apr 5, 2022
@nandorojo
Copy link
Author

nandorojo commented Apr 5, 2022

The issue is node-vibrant. I added that to the snack. It gets the pallet differently on mobile and desktop browsers. Not sure what could cause that.

IMG_6051

@nandorojo
Copy link
Author

I opened an issue on node-vibrant: Vibrant-Colors/node-vibrant#132

@nandorojo
Copy link
Author

I ultimately decided to call the function from a server to always get consistent results. Bummer cause it's slower, but it works that way.

@osamaqarem
Copy link
Owner

I do wish to explore if this library could be re-written to wrap another C++ library for image color extraction using JSI and WASM for web. I think this is the last resort to unify results for all platforms. Just need to find the time since I have no experience with all of that and would have to explore if its doable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants