<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/okmain-weiv96rpi" -->

---
title: Okmain | daily.dev
description: A developer built Okmain, a Rust library (with Python bindings) for extracting visually pleasant dominant colors from images. The approach improves on the...
canonical: https://daily.dev/posts/okmain-weiv96rpi
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Okmain | daily.dev
og:description: A developer built Okmain, a Rust library (with Python bindings) for extracting visually pleasant dominant colors from images. The approach improves on the...
og:url: https://daily.dev/posts/okmain-weiv96rpi
og:image: https://api.daily.dev/og/posts/WEiV96rPI.png
og:image:alt: Okmain
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Okmain

**[Hacker News](https://daily.dev/sources/hn)** · 8 min read · 4 upvotes · 1 comments

## Summary

A developer built Okmain, a Rust library (with Python bindings) for extracting visually pleasant dominant colors from images. The approach improves on the naive 1x1 resize trick by using k-means clustering in the Oklab perceptual color space instead of sRGB, applying center-weighted pixel prominence scoring, and optimizing for performance via downsampling, structure-of-arrays layout, and auto-vectorization. The post covers the algorithmic choices, performance tuning details, and a candid assessment of using Claude Opus via an agentic coding tool — finding it useful for boilerplate but unreliable for low-level SIMD-friendly code and clean abstractions.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://dgroshev.com/blog/okmain/>

## Community discussion

Top comments from developers on daily.dev.

**@akkitto** · 0 upvotes

> Could be very useful for Midjourney, too.

## Similar posts on daily.dev

- [Creating a Color Palette from an Image — Amanda Hinton](https://daily.dev/posts/creating-a-color-palette-from-an-image-amanda-hinton-xk9e9debm) · Hacker News · 0 upvotes · 0 comments
- [Color picking Oklch for mortals – Hugo Daniel](https://daily.dev/posts/color-picking-oklch-for-mortals-hugo-daniel-x8aaghqka) · Lobsters · 0 upvotes · 0 comments

---

Tags: [#rust](https://daily.dev/tags/rust), [#computer-vision](https://daily.dev/tags/computer-vision)

[View this post on daily.dev](https://daily.dev/posts/okmain-weiv96rpi)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Okmain","url":"https://daily.dev/posts/okmain-weiv96rpi","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/okmain-weiv96rpi"},"datePublished":"2026-03-13T13:51:54.981Z","dateModified":"2026-03-13T13:52:23.078Z","description":"A developer built Okmain, a Rust library (with Python bindings) for extracting visually pleasant dominant colors from images. The approach improves on the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a98c897743f43c995a495a96216a0f3b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a98c897743f43c995a495a96216a0f3b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/okmain-weiv96rpi","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"rust,computer-vision","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"Okmain"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/okmain-weiv96rpi","comment":[{"@type":"Comment","text":"Could be very useful for Midjourney, too.","datePublished":"2026-03-15T03:03:08.057Z","url":"https://daily.dev/posts/WEiV96rPI#c-pEnqWKsKV","author":{"@type":"Person","name":"Daniel","url":"https://daily.dev/akkitto","image":"https://media.daily.dev/image/upload/s--FtwJqX4c--/f_auto/v1754900041/avatars/avatar_29TCpY2hJR72V3BlxPXzX?_a=BAMClqZW0"}}]}
```

