Code Monkey home page Code Monkey logo

jpegasus's Introduction

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

Demo

Code example

const jpegasus = require('Jpegasus');

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

module.exports = {
    processFile
};

Parameters

  • First parameter: JavaScript File
  • Second parameter: Object of options
    • allowCrossOriginResourceSharing: a boolean that determines if CORS should be allowed, defaults to false.
    • maxHeight: the max height in pixels of the compressed output File, defaults to image's original height.
    • maxWidth: the max width in pixels of the compressed output File, defaults to image's original width.
    • quality: degrades quality of File, values is between 0.01 and 1.00, defaults to 0.50.
    • returnOriginalOnFailure: a boolean that determines if jpegasus should return the original File on failure or if it should throw and the let the consumer handle the failure, defaults to true.
    • scaleImageBy: a decimal to scale up or down the image width and height by, defaults to 1.00.

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

๐Ÿค”

jpegasus's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar lounsbrough avatar tonybrobston avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.