JSPM

client-side-image-resize

1.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 112
  • Score
    100M100P100Q76427F
  • License ISC

To resize or compress image file by weight and height. Image compression with extension: jpg/jpeg, svg, png, gif. This is a fork of https://github.com/arun-kataria/image-file-resize, but with an added feature of proportional resize.

Package Exports

  • client-side-image-resize

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (client-side-image-resize) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

client-side-image-resize

...with proportial resize support!

This project is a fork of https://www.npmjs.com/package/image-file-resize.

This node module to resize the image file according to width and height. Also you can change the extension of a file. And also it is very lightweight.

Live demo

Install

npm install client-side-image-resize --save

Examples of how to use it

    import convert from 'client-side-image-resize';

    convert({ 
        file: e.target.files[0],  
        width: 600, 
        height: 400, // You can ommit width or height and it will resize proportionally.
        type: 'jpeg'
        }).then(resp => {
            // Response contain compressed and resized file
        }).catch(error => {
             // Error
        })

Parameter to send

Object need to send as a parameter and contain these data.

Key Required/Optional Description
file Required Contain browser file object.
width Optional Width of image required Default is auto
height Optional Height of image required Default is auto
type Optional Type of image required Default is jpeg

Remember: one of width or height is required.

You can convert image only in jpg, gif, bmp, png, jpeg.