lovell / lovell/sharp

composing an image from multiple channels data

Open
#1,757 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

What are you trying to achieve?
Extracting channels from an image, and re-composing them into a different setup

Have you searched for similar questions?
yes

Are you able to provide a standalone code sample that demonstrates this question?
yes

Are you able to provide a sample image that helps explain the question?
no

---
I'm not sure if this is something that would warrant a new feature being added, or just some clarification to the documentation, but it took me quite some time (actually reading the test suite, rather than the documentation) to figure out that joinChannel keeps adding new channels to a file, despite the documentation appearing to suggest that if you give it an array form, it might replace/overwrite the channels, since you can specify [ red, green, blue, alpha ] format if your image is RGB.

That is clearly not how it works after reading the test suite.

Perhaps a "replaceChannel" function, or just explaining in joinChannel, that if you want to replace channels, you'll need to compose them together starting from a single channel image.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the joinChannel documentation and the related test suite, which the issue identifies as showing the actual behavior. Compare the documented array form with the tests, then clarify whether channels are appended and document the single-channel composition workaround; a separate replaceChannel feature would need an explicit decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
computer-vision, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.