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
Has alpha #585
Has alpha #585
Conversation
1d8b67b
to
4ebd8e2
Compare
packages/jimp/test/filetypes.test.js
Outdated
@@ -135,3 +135,17 @@ describe('FileType', () => { | |||
image.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); | |||
}); | |||
}); | |||
|
|||
describe('hasAlpah', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alpha (typo)
packages/core/src/index.js
Outdated
const alpha = this.bitmap.data[idx + 3]; | ||
|
||
if (alpha !== 0xff) { | ||
hasAlpha = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how well v8 and others engines read the code ahead, but wouldn't it be faster to return early ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the for loops check for hasAlpha to be false so once if find an alpha channel both the loops break. I will go through every pixel if it doesn't find an alpha channel though.
README.md
Outdated
@@ -11,6 +11,8 @@ An image processing library for Node written entirely in JavaScript, with zero n | |||
|
|||
Installation: `npm install --save jimp` | |||
|
|||
API documnetation can be found in the main [jimp package](./packages/jimp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo documentation
@edi9999 comments addressed |
6c22da2
to
c80b4bb
Compare
What's Changing and Why
determine if an image is using the alpha channel.
closes #271
What else might be affected
Tasks
jimp.d.ts