Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
compress.js
Advanced tools
A JavaScript client side image compression. This library uses the Canvas API to compress the image, and thus will not work on the node.js server-side.
Maintaining open source is not easy. Would be great if you could show some support!
There are several limitations for this library:
image/gif
, the compressed image will no longer animate.image/png
with transparent background, the compressed image will lose transparency and result in black background.NPM Package here.
npm install compress.js --save
const Compress = require('compress.js')
You can also include the build/compress.min.js
in your project directory, and then importing it using type module
in the script tag.
<!-- index.html -->
<script type="module" src="index.js"></script>
// index.js
import Compress from "./compress.min.js";
// ...
Try out our demo here.
import Compress from "./compress.min.js";
const compressor = new Compress();
// Listen to file upload events.
upload.addEventListener(
"change",
async function (evt) {
const file = evt.target.files[0];
const newFile = await compressor.compress(file, {
quality: 0.95,
crop: true, // If true, will crop a square image from the center.
maxWidth: 320, // Image width will not exceed 320px.
maxHeight: 320, // Image height will not exceed 320px.
});
// Display the image on the img element.
img.src = URL.createObjectURL(newFile);
},
FAQs
A client side JavaScript image compression library
The npm package compress.js receives a total of 10,234 weekly downloads. As such, compress.js popularity was classified as popular.
We found that compress.js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.