TintTrove is a simple and elegant image color picker tool that extracts dominant colors from uploaded images. Designed to help designers, artists, and developers explore color palettes with ease. The project is powered by a KMeans clustering algorithm and deployed on Heroku. Watch the video
- Extracts dominant colors from any uploaded image.
- Provides HEX and RGB values of colors.
- Responsive and user-friendly design.
- Built for seamless performance with minimal load times.
The core functionality relies on the following algorithm:
def get_colors(image, number_of_colors, show_chart=False):
if image.shape[2] == 4:
image = cv2.cvtColor(image, cv2.COLOR_RGBA2RGB)
elif image.shape[2] == 1:
image = cv2.cvtColor(image, cv2.COLOR_GRAY2RGB)
reshaped_image = cv2.resize(image, (600, 400))
reshaped_image = reshaped_image.reshape(reshaped_image.shape[0] * reshaped_image.shape[1], 3)
clf = KMeans(n_clusters=number_of_colors)
labels = clf.fit_predict(reshaped_image)
counts = Counter(labels)
center_colors = clf.cluster_centers_
ordered_colors = [center_colors[i] for i in counts.keys()]
hex_colors = [RGB_HEX(ordered_colors[i]) for i in counts.keys()]
return hex_colors
- KMeans Clustering: Groups pixels in the image into
number_of_colors
clusters. - OpenCV: Used for image preprocessing (e.g., resizing, color conversion).
- HEX Conversion: Converts RGB values to HEX codes for easy usage in design tools.
TintTrove is deployed on Heroku, making it accessible anywhere.
Check out TintTrove live on Heroku
-
Clone the repository:
git clone https://github.com/your-username/tinttrove.git
-
Navigate to the project directory:
cd tinttrove
-
Install dependencies:
pip install -r requirements.txt
-
Run the application locally:
python app.py
-
Open the application in your browser at
http://localhost:5000
.
- Frontend: HTML, Tailwind CSS, GSAP
- Backend: Python, Flask
- Algorithm: KMeans clustering for color extraction
- Image Processing: OpenCV
- Deployment: Heroku
Contributions are welcome! Please fork this repository and submit a pull request.