Skip to content

Conversation

@LTDakin
Copy link
Collaborator

@LTDakin LTDakin commented Sep 30, 2025

Multi color channel Images for Datalab Color Operations

  • moved color utils to /utils/color.js
  • color operation uses a computed input parser to have multiple inputs
  • added color picker to color operation

TODO

  • Input page
  • Scaling Tools
  • Composite Image
  • Using a Worker so Composite Creation isn't blocking
  • Send Operation body request to backend

@jnation3406 jnation3406 requested a review from capetillo October 21, 2025 03:01
outputImage = new ImageData(payload.canvas.width, payload.canvas.height)
const outputImageData = outputImage.data
const numPixels = payload.canvas.width * payload.canvas.height * 4
for (let j = 3; j < numPixels; j += 4) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's up with these values? magic numbers!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic pixel indices. The images are RGBA - 4 channels - and so that loop is just filling in every 4th value which is the alpha to 255. I can add a comment.

if (colors.length > 0) {
// Set the first images color constributions as the base values
for (let j = 0; j < sharedArrays[0].length; j++) {
for (let c = 0; c < 3; c++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic numbers here too

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more pixel/color channel indices...

:min-inputs="MIN_COLOR_CHANNELS"
@insert-image="insertImage"
@remove-image="removeImage"
@add-channel="() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these not written as functions in the script?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really sure, I guess I'll move them into the script for readability

Copy link
Collaborator

@capetillo capetillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of magic numbers here and there, but it looks great. Nicely done, Jon

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.

3 participants