When I create material from an image, its color is always different. Confusing. Given an image as material, how can I calculate its color value?
What do you mean by different? Different how? What value are you looking for? It’s average RGB values?
Are you using the free web version of SketchUp as your profile indicates? Assuming your profile is correct and you are after the average RGB value, you can change the style to Shaded and then use some sort of color sampling application to sample the colors.
Keep in mind that by default, SketchUp applies a 3D shading or rendering effect to the face where the material is applied. This tends to darken the color, unless the camera is looking straight-on at the face.
When I create a material from choosing an image, the default color is different. I want to know the algorithm of the color.
The RGB values shown in the Materials window are based on the average color of the pixels in the texture image. As @TDahl indicated the way it is displayed on the model will be different because there is shading applied to create the appearance of a three dimensional shape on the 2D screen.
Your profile says you are using SketchUp Free (web) on a Mac. Your screen shot shows a desktop version of SketchUp on Windows. Please correct your profile.
Updated my profile. I use Sketchup Pro 2021 on Windows. Given an image, how can I calculate the color without Sketchup? Because I am creating an application of Three.js, and wondering how Sketchup computes the color of material.
It would have helped if you had asked that in the first place.
I would suggest you do a Google search on “average color of pixels”. There are a number of resources to tell you how to get the average.
Here’s a site that will give you the average from a dragged and dropped image.