Extract colors from an image

Using Python to extract colors from an image for the inspiration of designers and artists

Continue reading...

Featured Project
case study

Meet Nibby: The AI Concierge Revolutionizing Health Insurance Support

May 03, 2025

Nibby, an AI helper created for NIB Health Insurance, that answers questions and saves money while letting staff help with tricky problems.

Project
portfolio

Here's one thing you can do to master social media for your business in one minute

May 03, 2025

I created an AI tool that helps small businesses easily schedule and manage their social media posts, saving time while keeping their online presence strong.

From the Firehose

About

I built a fun tool that helps anyone grab colors from images easily, making it perfect for those who love vibrant design!

Sometimes you see a photo and love the colors in it. I wanted to make it super easy for anyone to find out what those colors are. So, I built a tool that pulls out the most used colors in a picture — and shows them to you!

You Can Use a Link or Upload Your Own Picture

You can use this tool two ways:

  • Paste a link to an image
  • Or upload one from your computer

Once you do, my tool reads the picture and shows you:

  • The main color (called the "dominant" color)
  • Other common colors that appear a lot
  • Both in hex codes (like #FF5733) and RGB values (like 255, 87, 51)

Behind the Scenes (Cool Code Stuff)

Here’s a peek at how I made it work:

if 'image' not in response.headers.get('Content-Type', ''):
    flash("URL did not return an image.")
    return redirect(url_for('extract_colors'))

This checks if the link you gave is actually an image. If it’s not, I stop the process and show a friendly error message.

dominant_color_hex = '#{:02x}{:02x}{:02x}'.format(*dominant_color)
common_colors_hex = ['#{:02x}{:02x}{:02x}'.format(*color) for color in common_colors]

After the image is read, I turn the color data into hex codes — the same kind you see in web design, like #FF5733. I also keep the original RGB values, like (255, 87, 51), so you get both!

image_file.save(temp_path)
image_url = url_for('static', filename=f"uploads/{image_file.filename}")

When you upload a photo, I save it temporarily so it can be used right away on the page. You even see the image on the website with the colors below it!

🎨 Why This Is Fun and Useful

Designers, artists, and even people making presentations often need to match or reuse colors. With this tool, you just give it a picture and get the exact colors instantly — both as easy-to-use hex codes and human-readable RGB values.

This is part of how I make smart tools using Python and AI. I love building things that feel like magic — but are actually powered by code under the hood.

Try it out on the color tool page and see what colors you discover!


Hungry for more? Let me take you on a journey through my latest project where I built a smart lead management tool! This handy application helps small business owners easily manage their leads by automating scheduling calls, sending reminders, and even creating summaries of conversations. Imagine having an assistant that organizes everything for you while you focus on what really matters—connecting with your leads!

This tool stands out because it integrates with Google Calendar to check available slots for calls, making scheduling a breeze. It also uses AI to transcribe calls and suggest lead statuses, saving tons of time. Plus, it keeps everything compliant with privacy laws by automatically deleting unqualified leads after 90 days. Ready to dive deeper into this exciting project? Let's explore the details!

Learn More

About

I built a fun tool that helps anyone grab colors from images easily, making it perfect for those who love vibrant design!