-
Notifications
You must be signed in to change notification settings - Fork 210
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
Text overlay now works in nodeJS #1518
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1518 +/- ##
==========================================
+ Coverage 66.64% 66.74% +0.09%
==========================================
Files 130 130
Lines 2674 2682 +8
Branches 430 432 +2
==========================================
+ Hits 1782 1790 +8
Misses 892 892
|
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 think the info.json file for TextOverlay has a required
field which needs to be removed. This field skips the test for this module.
Waiting for the tests.... |
Please fix the conflicts. Thanks! |
I am facing problem in running it in nodeJS after #1533, It is using Image element, but for some reason when I imported it from jsdom, the onload event is not firing and when I used ctx.putImageData instead of ctx.drawImage, text overlay stopped working for GIfs 😕 @ataata107 Why did you removed putImageData and used drawImage instead is there any major difference? |
Is it not working currently? |
No, it isn't |
#1533 was a dangerous PR. We need to do a followup soon and fix some things. |
Hmm. Would you like to open an issue for this? Also mention some things which broke. |
Issue opened! |
@blurry-x-face I had to do that because putting pixels (of gifs) onto canvas was tampering the data. But instead if I used the source url it worked fine |
Ok, so after A LOT OF DEBUGGING, I finally found the reason why this was having problem running in node, turns out the problem was this
generateOutput was getting called beore the extramanipulation was completed so generateOutput was getting run twice!! one time in pixelManipulation and one time in extramanipulation image-sequencer/src/modules/TextOverlay/Module.js Lines 15 to 17 in f6d5316
Therefore in node the output was generated from the first generateOutput call hence the image was not getting changed because the way image is generated from cli is that it generates the image the first time generateOutput is called, so to fix this what we can do is: if (options.extraManipulation){
frames[f] = options.extraManipulation(framePix, setRenderState, generateOutput) || framePix; // extraManipulation is used to manipulate each pixel individually.
perFrameShape = frames[f].shape;
}else
generateOutput(); And then each module that uses extramanipulation we have to call generateOutput after extramanipulation is completed like we do in text-overlay! 😩 image-sequencer/src/modules/TextOverlay/Module.js Lines 15 to 17 in f6d5316
I'll open an issue regarding this and make a PR for it super soon! @jywarren @harshkhandeparkar I want your thoughts on it! |
Needs a small rebase. |
Concerns #1378
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
npm test
@publiclab/is-reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Please make sure to get at least two reviews before asking for merging the PR as that would make the PR more reliable on our part
Thanks!