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

Fix minify Module #1512

Merged
merged 10 commits into from
Jan 21, 2020
Merged

Fix minify Module #1512

merged 10 commits into from
Jan 21, 2020

Conversation

rishabhshuklax
Copy link
Member

@rishabhshuklax rishabhshuklax commented Jan 15, 2020

Fixes #1420

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with npm test
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • ask @publiclab/is-reviewers for help, in a comment below
  • Insert-step functionality is working correct as expected.

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If 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!

@rishabhshuklax
Copy link
Member Author

@publiclab/is-reviewers please review this.
Error was because of this

output(base64data, input.format);

function output(image, datauri, mimetype, wasmSuccess) {

@codecov
Copy link

codecov bot commented Jan 15, 2020

Codecov Report

Merging #1512 into main will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             main   #1512      +/-   ##
=========================================
+ Coverage   66.79%   66.8%   +0.01%     
=========================================
  Files         129     129              
  Lines        2671    2672       +1     
  Branches      430     430              
=========================================
+ Hits         1784    1785       +1     
  Misses        887     887
Impacted Files Coverage Δ
src/modules/PaintBucket/PaintBucket.js 100% <100%> (ø) ⬆️

@root00198
Copy link
Member

The thing was that, this module is not minifying the image... If you compare input image and output image, they both are same.

@rishabhshuklax
Copy link
Member Author

That's what this PR fixes.
The problem was caused by, I'm assuming #1365

@root00198
Copy link
Member

#1422

Check this PR

@harshkhandeparkar
Copy link
Member

Why doesn't this module use pixel manipulation?

@rishabhshuklax
Copy link
Member Author

This uses compressorjs in browser environment for minifying image so we don't need to use pixel manipulation.

@harshkhandeparkar
Copy link
Member

Can it minify GIFs?

@rishabhshuklax
Copy link
Member Author

rishabhshuklax commented Jan 16, 2020

It doesnt use compressorjs in node env because our current code uses DOM elements like Blob, atob and even if we import them from jsdom the compressorjs uses Image() so it is throwing error in node that's why it is not using copressorjs in node but is using imagemin but I am getting this error, do you know anything about it @harshkhandeparkar

(node:26177) UnhandledPromiseRejectionWarning: Error: spawn /home/rs007/nodeJs/image-sequencer/node_modules/jpegtran-bin/vendor/jpegtran ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:26177) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

@harshkhandeparkar
Copy link
Member

No, I have no idea about what that error means.

@rishabhshuklax
Copy link
Member Author

Can it minify GIFs?

No, It just gives first frame as output image, i'm searching for an alternative
Do you have any idea?

@rishabhshuklax
Copy link
Member Author

As of now it can just minimize jpg/jpeg/webp in browser

@harshkhandeparkar
Copy link
Member

Do you have any idea?

Nope.

@rishabhshuklax rishabhshuklax changed the title Fix minify Module Fix minify Module in browser Jan 18, 2020
@jywarren jywarren requested a review from Divy123 January 19, 2020 00:47
@rishabhshuklax
Copy link
Member Author

Now this works in NodeJs too!

@rishabhshuklax rishabhshuklax changed the title Fix minify Module in browser Fix minify Module Jan 20, 2020
@jywarren jywarren merged commit 2cd728b into publiclab:main Jan 21, 2020
@jywarren
Copy link
Member

Thank you! This is great!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minify-Image module not working
4 participants