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

feat: add colour filters to vips image processor #36

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

knarewski
Copy link
Contributor

Background

GdkPixbuf-based image processing can take over 1GB of memory for processing a single high-resolution photo. We've decided to introduce another processor hoping that it'll improve Morandi's memory profile and performance.

Problems

Vips processor doesn't support colour filters

Solution

Add support for colour filters

Notes

  • the filter matrices are designed for RGB, so the image needs to use that colourspace
  • the recomb call effectively converts image to grayscale; there are potentially more elegant and efficient ways to achieve similar result (eg img.colourspace('b-w')); this solution was chosen to preserve the same grayscale formula as used in GdkPixbuf-based processor, may be reevaluated later

Pixbuf vs Vips comparison

Sepia processing on a grayscale picture (left - pixbuf, right - vips), mean average error: 0.000185
Bluetone processing on a generated picture (left - pixbuf, right - vips), mean average error: 0.0000002

Other images can be compared by opening files with identical names in spec/fixtures/reference_images/ and spec/fixtures/reference_images/vips/

@knarewski knarewski requested a review from a team November 25, 2024 14:25
Base automatically changed from feat-introduce-vips-image-processor to master November 27, 2024 08:09
Notes:
- the filter matrices are designed for RGB, so the image needs to use that colourspace
- the recomb call effectively converts image to grayscale; there are potentially more elegant
  and efficient ways to achieve similar result (eg img.colourspace('b-w')); this solution was chosen to preserve
  the same grayscale formula as used in GdkPixbuf-based processor
@knarewski knarewski force-pushed the feat-add-vips-colour-filters branch from 3f29da4 to fd87f71 Compare November 27, 2024 12:34
@knarewski knarewski merged commit 5a33f46 into master Nov 29, 2024
15 checks passed
@knarewski knarewski deleted the feat-add-vips-colour-filters branch November 29, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants