Skip to content

TonyBrobston/jpegasus

Repository files navigation

jpegasus

A client-side JavaScript tool that takes in a File of type .jpeg, .png, or .gif and returns a compressed File of type .jpeg. It's as easy as taking out the trash! 🗑

npm version Build Status codecov Dependencies Dev Dependencies Peer Dependencies Maintainability Known Vulnerabilities All Contributors

Implementation example

Code example

const jpegasus = require('jpegasus');

function processFile(file) {
    return jpegasus.compress(file, {
        maxHeight: 1000,
        maxWidth: 1000,
        quality: 0.65
    });
}

module.exports = {
    processFile
};

Documentation

compress(file: File, inputOptions: InputOptions): Promise‹File | Blob›

determineOrientation(file: File | Blob): Promise‹number›

Caution

  • Note that when the preserveFileType option is true, the quality option will only work for files such as image/jpeg and image/webp per the MDN web docs here.

Feedback

Do you have an idea for making jpegasus better? Add your idea under the issues tab, we'd love to hear about it!

Contributors

Thanks goes to these wonderful people:

Tony Brobston
Tony Brobston

💻
KANG
KANG

🎨 💻
lounsbrough
lounsbrough

💻
Tate Button
Tate Button

🤔