Giter Site home page Giter Site logo

coolaj86 / js-browser-image-upload-and-scale-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maxsultan/img-compressor

0.0 1.0 0.0 81 KB

Image upload and scale demo

Home Page: https://maxsultan.github.io/img-compressor/

HTML 35.75% JavaScript 54.62% CSS 9.63%
image image-resize image-resizer image-scaling javascript js resize resizer resizing scale scaling image-scaler

js-browser-image-upload-and-scale-demo's Introduction

img-compressor

Minify and resize images using lossy compression all on the front-end

Visual Preview:

This can be previewed here:

https://maxsultan.github.io/img-compressor/

How it Works:

Canvas elements can be used to draw images via javascript. By default it does this using bilinear interpolation.

Here are some basic definitions:

  • Bilinear Interpolation uses a weighted average of the four nearest cell centers. The closer an input cell center is to the output cell center, the higher the influence of its value is on the output cell value. This means that the output value could be different than the nearest input, but is always within the same range of values as the input.

  • BiCubic Interpolation looks at the 16 nearest cell centers to the output and fits a smooth curve through the points to find the value. Not only does this change the values of the input but it could also cause the output value to be outside of the range of input values (imagine a sink or a peak occurring on a surface).

Implimented Features:

  • upload an image
  • view a preview of the compressed image
  • see the image file size before and after compression
  • download a compressed version of the image
  • copy a data url pointing to the image
  • customize the quality of the compressed image
  • customize the dimensions of the image
  • chose to perserve or disregard the aspect ratio of the image
  • copy an image and paste in onto the webpage to have it compressed
  • drag and drop an image into a drop area to have it compressed

Dependencies

This is a demo project for an npm package I built called front-end-min:

the package can be viewed on NPM here: https://www.npmjs.com/package/front-end-min

it can be added via npm: npm install front-end-min

or unpkg link: <script src="https://unpkg.com/[email protected]/index.js"></script>

js-browser-image-upload-and-scale-demo's People

Contributors

maxsultan 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.