Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract colors using color quantization #36

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Conversation

thekid
Copy link
Owner

@thekid thekid commented Nov 4, 2022

Idea

Use the palette color to create the border or a maybe ambient glow in the lightbox - see #34. We would extract the palette during import and store it in MongoDB. These colors could also be used for a "search for similar images" feature, or for grouping images as seen in http://dialog.friebes.info/topic/colors__green

Examples

Created via https://gist.github.com/thekid/795c35bec603c0f217cb5445cc901ded

Street art

Street art

Urban

Urban

Nature / people

Nature / people

Colors

Colors
Colors: #273218, #cdcdce, #9ea79b, #818877, #939898, #67775d, #5d655b, #58613d, #ac848c, #ac8c74

Inspiration

Ported from https://github.com/lokesh/color-thief

@thekid thekid added the enhancement New feature or request label Nov 4, 2022
@thekid
Copy link
Owner Author

thekid commented Nov 9, 2022

Search by HSL bracket:

$hsl= sscanf($q, '(%d,%d,%d)');
$range= [
  'h' => [max(0, $hsl[0] - 5), min(360, $hsl[0] + 5)],
  's' => [max(0, $hsl[1] - 20), min(100, $hsl[1] + 20)],
  'l' => [max(0, $hsl[2] - 20), min(100, $hsl[2] + 20)],
];

image

image

thekid added a commit that referenced this pull request Nov 13, 2022
Prevents attributes containing arrays or maps from breaking rendering
with an "array to string" conversion error, see xp-forge/handlebars#24

This will permit us to refactor meta data more freely in the future,
e.g. as see in the "Extract colors" pull request, #36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant