How to extract colors from your images with Uploadcare

Step 1. Sign up for an Uploadcare account. Create your first project from the workpace.

create project screenshot Create new project

Step 2. Start uploading your images.

small party on the roof Here’s our test image.

All transformations at Uploadcare are done via CDN image operations. Once an image is uploaded, you receive a CDN link with its own unique identifier (UUID). The link looks like this:


  • 9c71f68a-3e48-4c89-8796-8e4730dab793 — your unique file identifier (UUID).
  • party.jpeg — the filename (it’s optional, you can remove it)

Step 3. Implement image transformations by URL API.

To make an API request, simply add the necessary parameters to the link. To extract colors from a photo, you need to add the parameters preview and main colors. Also, you can use the number of colors parameter if you need it.

After adding all the needed parameters, the link will look something like this:

Preview is the default operation for all image transformations. /-/ is the mandatory delimiter that tells operations from one another and other path components.

If everything is right, it will return a JSON containing the RGB values of the main colors found in the image:

    [65, 126, 156],
    [38, 36, 32],
    [199, 170, 154]
color recognition in actionThe Color Recognition feature extracted the three main colors from the photo.

That’s it! Now you can apply this feature to your own business processes and build different solutions around it.

Final thoughts

Color Recognition is a part of the Image Intelligence feature set, which also includes AI-based tools for Object and Face Recognition. All three features allow you to extract valuable insights from any photo and use them to organize large databases of images, moderate uploaded content, filter content, and much more.

If you're interested in automating your image handling to the max, you can read our docs to learn more or jump right into hands-on exploration.

Build file handling in minutesStart for free

Ready to get started?

Join developers who use Uploadcare to build file handling quickly and reliably.

Sign up for free