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

Lossless compression module #1603

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Lossless compression module #1603

wants to merge 4 commits into from

Conversation

daemon1024
Copy link
Member

@daemon1024 daemon1024 commented Jan 31, 2020

Fixes #1505

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 run test-all
  • 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!

@welcome
Copy link

welcome bot commented Jan 31, 2020

Thanks for opening this pull request!
There may be some errors, but don't worry! We're here to help! 👍🎉😄

@rishabhshuklax rishabhshuklax changed the title [WIP] Lossless compression module Lossless compression module Feb 1, 2020
@daemon1024
Copy link
Member Author

daemon1024 commented Feb 1, 2020

I can't seem to understand how do I pass the input to the compress_images function. I think it needs a path to the image but i am getting input as an argument from the draw function so i don't get how to pass and process it.

@publiclab/is-reviewers

"name": "lossless-compression",
"description": "Losslessly Compresses images",
"input": {}
}

Choose a reason for hiding this comment

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

add a reference to the docs

output: output,
UI: UI
};
};

Choose a reason for hiding this comment

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

does this work? What do you get as an output after running this? @daemon1024

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't seem to insert the lossless-compression as a step. I can't seem to understand how to pass the input in the function. The parameter required there is path to the file, but the incoming data is a dataURI.

Copy link
Member Author

Choose a reason for hiding this comment

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

https://hastebin.com/bakopiwino.coffeescript
This is the error I get when i run npm run test-all

Choose a reason for hiding this comment

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

don't run the test right now. Tests are to be ran later when the module is complete.

Choose a reason for hiding this comment

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

see from line 64 to line 81 of Module.js file of MinifyImage module inside src/modules/MinifyImage. There they have taken dirname/images as a file path and passed imagemin on it. @daemon1024

Copy link
Member Author

Choose a reason for hiding this comment

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

@niravasher that part in Minify Module seems like to be used when the inBrowser options is false. They created that to run rest and stuff prolly.

@niravasher
Copy link

@blurry-x-face @jywarren @harshkhandeparkar @publiclab/is-reviewers please help @daemon1024 . I have quizes going on.

@daemon1024
Copy link
Member Author

@niravasher Thanks a lot for taking your time out from your quizzes and helping me out.

I have asked for help in gitter channel too. Hopefully someone else can help me out too :)

@niravasher
Copy link

niravasher commented Feb 6, 2020

Thanks a lot for taking your time out from your quizzes and helping me out.

No problem bro. Always love to help (although I am not an expert here 😄 )
The minifyImage module is also an npm module https://www.npmjs.com/package/imagemin . Compare this module with the one you are using. See how the images are used as input files. Then see in compress-image module how files are used as an input like in the lines 64 to 81 and try to do the same thing. @daemon1024

@gitpod-io
Copy link

gitpod-io bot commented Jul 7, 2020

@codecov
Copy link

codecov bot commented Jul 7, 2020

Codecov Report

Merging #1603 into main will increase coverage by 9.96%.
The diff coverage is 62.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1603      +/-   ##
==========================================
+ Coverage   55.11%   65.08%   +9.96%     
==========================================
  Files         117      134      +17     
  Lines        2344     2761     +417     
  Branches      360      440      +80     
==========================================
+ Hits         1292     1797     +505     
+ Misses       1052      964      -88     
Impacted Files Coverage Δ
examples/lib/scopeQuery.js 18.51% <ø> (ø)
src/Modules.js 100.00% <ø> (ø)
src/modules/WebglDistort/Module.js 2.29% <0.00%> (ø)
src/ui/SetInputStep.js 12.90% <0.00%> (-1.39%) ⬇️
src/modules/ColorHalftone/Module.js 3.63% <3.63%> (ø)
examples/lib/defaultHtmlStepUi.js 11.35% <4.08%> (-0.85%) ⬇️
examples/lib/intermediateHtmlStepUi.js 11.11% <5.55%> (+0.94%) ⬆️
src/modules/LosslessCompression/Module.js 15.78% <15.78%> (ø)
examples/lib/insertPreview.js 13.15% <20.00%> (-0.36%) ⬇️
src/util/getImageDimensions.js 20.00% <20.00%> (ø)
... and 104 more

@harshkhandeparkar
Copy link
Member

@daemon1024 Converting this to a draft for now. Please feel free to make it to a normal PR if you get time to push the requested changes :)

@harshkhandeparkar harshkhandeparkar marked this pull request as draft October 17, 2020 16:13
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.

Lossless image compression
4 participants