Compare two colors. Average color of an image. Code proposals

Hello friends,

in this topic I wrote about the color number:

Now I have written a tutorial on a Spanish web page with codes to compare colors, but in this topic I prefer to propose that users create the codes. If you need the codes, you can request them by message.

Here .apk files:

1.- Vector color 3D.

  • Using three Sliders create a color and finds the modulus and the alpha, beta and gamma angles of an RGB color.
  • Calculate the maximum value when M (255,255,255)



2.- Compare color RGB. Method difference between RGB vectors.

Read this:

Percent : d / sqrt((255)^2+(255)^2+(255)^2) = d / 4,417

3.- Compare two colors using the following algorithm.

from: How to compare two colors for similarity/difference (Stackoverflow)

4.- Using three Sliders create a color and compare it to the PH color scale. (use the method from the previous exercise.)

Search images PH color scale.

5.- Get average color of an image.

Read this:
How can I get the average colour of an image (Stackoverflow)

  • We have a jpg image, get average color of that image by two methods.
    a) Using a Canvas and the TouckDown block, tap on the image several times and get its color R, G and B, average.
    b) Using a loop for each ... from, get 200 random x, y points and calculate their average color.

hay can you make a complete picture of the blocks for me


If you need the codes, you can request them by message.

6.- Pixelates an image with dots.

  • Divide an image into rectangles. Get the color of 4 random points in each rectangle.
  • Find the average color of those points. Draw a point corresponding to that rectangle on another Canvas.

Here .apk file.