Skip to content

Add colour extraction Job#3411

Merged
ildyria merged 2 commits intocolor-extractionfrom
add-extract-color-job
Jun 7, 2025
Merged

Add colour extraction Job#3411
ildyria merged 2 commits intocolor-extractionfrom
add-extract-color-job

Conversation

@ildyria
Copy link
Copy Markdown
Member

@ildyria ildyria commented Jun 5, 2025

This pull request introduces a feature for extracting dominant colors from images, along with supporting changes to integrate and test the functionality. The most significant changes include the addition of a new job for color extraction, a helper class for image processing, and updates to the database and configuration to enable this feature. Below is a breakdown of the key changes by theme:

Color Extraction Feature:

  • app/Jobs/ExtractColoursJob.php: Added a new job class, ExtractColoursJob, to extract the five most dominant colors from an image and store them in the database. It supports both GD and Imagick drivers for image processing.
  • app/Image/Handlers/ImageFactoryForColourExtraction.php: Introduced a helper class, ImageFactoryForColourExtraction, to create image instances using either the GD or Imagick libraries for color extraction.

Database and Configuration Updates:

  • database/migrations/2025_06_04_193132_optional_color_extraction.php: Added a migration to introduce a new configuration option, extract_colours_from_image, allowing users to enable or disable color extraction.
  • app/Http/Middleware/ConfigIntegrity.php: Updated the configuration integrity check to include the new extract_colours_from_image setting.

Enhancements to Models:

  • app/Models/Colour.php: Added a static method, fromHex, to create or update Colour instances from hexadecimal strings.
  • app/Models/Palette.php: Added a method, fromHex, to convert hexadecimal color strings to integer representations for storage.

Dependency and Testing:

  • composer.json: Added the farzai/color-palette library as a dependency for color extraction functionality.
  • tests/Feature_v2/Jobs/ExtractColoursJobTest.php: Created a test suite to validate the ExtractColoursJob, ensuring it works correctly with both GD and Imagick drivers.

These changes collectively enable the extraction and storage of dominant image colors, providing a foundation for enhanced image-related features.

@ildyria ildyria requested a review from a team as a code owner June 5, 2025 08:13
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 70.37037% with 56 lines in your changes missing coverage. Please review.

Project coverage is 86.66%. Comparing base (5681a0e) to head (75ce78d).
Report is 1 commits behind head on color-extraction.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria force-pushed the add-extract-color-job branch 2 times, most recently from 0203bfe to 780ff10 Compare June 5, 2025 19:08
@ildyria ildyria force-pushed the color-extraction branch from 495ff23 to 5681a0e Compare June 5, 2025 20:08
@ildyria ildyria force-pushed the add-extract-color-job branch 2 times, most recently from fca1e88 to 3b9b3bf Compare June 6, 2025 15:09
@ildyria ildyria added the Review: easy Easy review expected: probably just need a quick to go through. label Jun 6, 2025
@ildyria ildyria force-pushed the add-extract-color-job branch from 3b9b3bf to fcbfd6c Compare June 6, 2025 15:30
@ildyria ildyria force-pushed the add-extract-color-job branch from fcbfd6c to 0073bb4 Compare June 6, 2025 15:32
@ildyria ildyria merged commit f9f6769 into color-extraction Jun 7, 2025
33 checks passed
@ildyria ildyria deleted the add-extract-color-job branch June 7, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review: easy Easy review expected: probably just need a quick to go through.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants