Colors

colors_example_1

Our color service is trying to answer a question: what is the color of the product on given image? Currently we provide 2 kinds of answer, both providing list of colors (hex format) and their weights (predicted proportions of product being in that color as a float from 0 and 1).

Dominant vs Palette

  • dominant colors: colors in the image that best describe the product (any of 256^3 colors might appear in the result)

  • palette colors: colors from a given palette that best describe the product (only colors in the palette may appear in the result)

Color Palette

We currently support only following palette

palette

[
    [255, 255, 0],
    [255, 128, 0],
    [255, 0, 0],
    [255, 192, 215],
    [138, 44, 44],
    [150, 75, 0],
    [217, 190, 141],
    [204, 119, 34],
    [255, 0, 144],
    [106, 13, 173],
    [0, 85, 255],
    [0, 0, 179],
    [64, 224, 208],
    [40, 245, 70],
    [0, 130, 0],
    [190, 190, 190],
    [110, 107, 34],
    [0, 0, 0],
    [255, 255, 255]
]

API Usage

  • Both Palette and Dominant colors are updated automatically by processing customers feed

  • Results are filled into Catalogue as look.instance attributes

  • For more details and complete list of available endpoints see Catalogue: Look section in interactive OpenAPI docs.

Dominant Colors Schema

colors

list of rgb (dominant) colors present in image

weights

proportion of product pixels covered by corresponding colors

  • example

{
  "colors": [
    [234,  188, 190],
    [243, 241, 240],
    [50, 27, 21],
    [156, 117, 120],
    [249, 220, 228],
    [138, 67, 70],
    [192, 140, 140],
    [161, 148, 153],
    [120, 94, 88]
  ],
  "weights": [
    0.8289990928333837,
    0.10757484124584216,
    0.051708497127305714,
    0.004989416389476867,
    0.004384638645297853,
    0.0009071666162685213,
    0.000680374962201391,
    0.00045358330813426064,
    0.0003023888720895071
  ]
}

Palette Colors Schema

indices

indices of Color Palette (starting from 0)

colors

list of rgb (palette) colors present in image

weights

proportion of image pixels covered by corresponding colors

  • example

{
  "indices": [3, 18, 5, 4, 15],
  "colors": [
    [255, 192, 215],
    [255, 255, 255],
    [150, 75, 0],
    [138, 44, 44],
    [190, 190, 190]
  ],
  "weights": [
    0.8340641064408829,
    0.10757484124584216,
    0.05201088599939522,
    0.005896583005745389,
    0.00045358330813426064
  ]
}

Example Query - look detail

  • request

LOOK_ID='793769'

curl \
    -X GET "${API_BASE_URL}/looks/${LOOK_ID}" \
    -H "accept: application/json" \
    -H "x-api-key: ${API_KEY}" \
    -H "Authorization: None"
  • response

{
  "id": "793769",
  "code": "793769",
  "instance": {
    "palette-colors": {
      "indices": [
        15
      ],
      "colors": [
        [190, 190, 190]
      ],
      "weights": [
        1
      ]
    },
    "dominant-colors": {
      "colors": [
        [48, 48, 48],
        [221, 220, 214],
        [75, 76, 76],
        [86, 86, 86],
        [117, 116, 114],
        [100, 100, 99],
        [139, 139, 140],
        [148, 148, 147],
        [100, 92, 100]
      ],
      "weights": [
        0.933251195825482,
        0.03348311349470938,
        0.015509494129583998,
        0.010436295115234091,
        0.004275982026380635,
        0.0016669082475721118,
        0.0007247427163357008,
        0.0005797941730685607,
        0.00007247427163357009
      ]
    }
  },
  "product": {},
  "primary_image": {}
}

Example Query - look list

useful for iterating through many or all looks

  • request

curl \
    -X GET "${API_BASE_URL}/looks?limit=3" \
    -H "accept: application/json" \
    -H "x-api-key: ${API_KEY}" \
    -H "Authorization: None"
  • response

  {
  "links": {
    "next": "/looks?limit=3&offset=3",
    "prev": null,
    "limit": 3,
    "offset": 0
  },
  "results": [
    {
      "id": "1527",
      "code": "1527",
      "instance": {
        "color": "Black/Black",
        "palette-colors": {
          "indices": [17, 15],
          "colors": [
            [0, 0, 0],
            [190, 190, 190]
          ],
          "weights": [
            0.8031608462911037,
            0.19683915370889626
          ]
        },
        "dominant-colors": {
          "colors": [
            [37, 37, 39],
            [75, 73, 76],
            [102, 100, 104],
            [209, 208, 206],
            [83, 83, 92],
            [92, 84, 91],
            [68, 60, 66],
            [137, 137, 140],
            [148, 140, 142]
          ],
          "weights": [
            0.8031608462911037,
            0.08253887331124139,
            0.07637012490440989,
            0.013968901351006882,
            0.009227631914351261,
            0.007800152944175376,
            0.005913841447871527,
            0.0007137394850879429,
            0.0003058883507519755
          ]
        }
      },
      "product": {},
      "primary_image": {}
    },
    {
      "id": "1528",
      "code": "1528",
      "instance": {
        "color": "Brown/Brown",
        "palette-colors": {
          "indices": [5, 15],
          "colors": [
            [150, 75, 0],
            [190, 190, 190]
          ],
          "weights": [
            0.9805995588530179,
            0.019400441146982157
          ]
        },
        "dominant-colors": {
          "colors": [
            [46, 39, 40],
            [124, 87, 68],
            [84, 67, 64],
            [209, 205, 201],
            [97, 92, 87],
            [99, 97, 100],
            [148, 148, 143],
            [68, 68, 76],
            [148, 140, 156]
          ],
          "weights": [
            0.9167836374573892,
            0.03789853619410467,
            0.025917385201523962,
            0.01724483657509525,
            0.0011529977942650893,
            0.0005013033888109083,
            0.00035091237216763584,
            0.00010026067776218167,
            0.000050130338881090835
          ]
        }
      },
      "product": {},
      "primary_image": {}
    },
    {
      "id": "1530",
      "code": "1530",
      "instance": {
        "color": "Honey/Brown",
        "palette-colors": {
          "indices": [5, 6, 3],
          "colors": [
            [150, 75, 0],
            [217, 190, 141],
            [255, 192, 215]
          ],
          "weights": [
            0.9815378268268784,
            0.018152751276365325,
            0.0003094218967562271
          ]
        },
        "dominant-colors": {
          "colors": [
            [164, 96, 48],
            [48, 35, 33],
            [104, 65, 47],
            [177, 146, 125],
            [224, 215, 209],
            [97, 43, 21],
            [212, 168, 138],
            [184, 140, 100],
            [212, 180, 148]
          ],
          "weights": [
            0.7345160125831571,
            0.1501211902428962,
            0.07503480996338507,
            0.018410602856995514,
            0.01804961064411325,
            0.003197359599814347,
            0.0003094218967562271,
            0.00025785158063018924,
            0.0001031406322520757
          ]
        }
      },
      "product": {},
      "primary_image": {}
    }
  ]
}

#ffff00, #ff8000, #ff0000, #ffc0d7, #8a2c2c, #964b00, #d9be8d, #cc7722, #ff0090, #6a0dad, #0055ff, #0000b3, #40e0d0, #28f546, #008200, #bebebe, #6e6b22, #000000, #ffffff