gpt4 book ai didi

javascript - 如何在 native react 中提取图像中最常用的颜色?

转载 作者:行者123 更新时间:2023-11-28 03:10:44 50 4
gpt4 key购买 nike

我有一个需要图像处理的项目。在步骤 1 中,我需要获取应用程序中上传的图像中最常用的颜色,有人可以帮忙吗?

最佳答案

您可以使用这个库react-native-color-grabber这是与您的问题最接近的:

它返回如下:

var colorGrabber = require('react-native').NativeModules.colorGrabber
colorGrabber.getColors(image, (err, res) => {
console.log(res);
// Returns:
// {
// 'UIDeviceRGBColorSpace 0.0784314 0.0941176 0.0823529 1': '0.1666667',
// 'UIDeviceRGBColorSpace 0.215686 0.203922 0.262745 1': '0.1666667',
// 'UIDeviceRGBColorSpace 0.517647 0.45098 0.380392 1': '0.6666667'
// }
});

希望有帮助。如有疑问请放心

关于javascript - 如何在 native react 中提取图像中最常用的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60146263/

50 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com