GithubHelp home page GithubHelp logo

image-rotation's Introduction

image-rotation

This module can help the image complete compression and support rotation operations at any angle.

Installation

  yarn add image-rotation

Usage

let imageRotate
import ImageRotation from 'image-rotation'
imageRotate = new ImageRotation('your html file data', options)
imageRotate.generate('rotate angle', downloadType) // 

APIs

new ImageRotation

key desc type defalut
file(required) input[type=file] data File or base64 null
options options object {}

options(object)

key desc type defalut
maxLength The maximum edge size number null
quality compression quality number 0.92
background background string null
isDrawPngBg whether to draw background for image/png boolean false
import ImageRotation from 'image-rotation'
const imageRotate = new ImageRotation('your html file data', {
  maxLength: 2000,
  quality: 0.8,
  background: "#fff",
  isDrawPngBg: true
})

generate(rotate?: number, downloadType?: DownloadType): Promise

key desc type defalut
rotate rotation angle Number 0
downloadType image type string image/jpeg
const imageRotate = new ImageRotation('your html file data')
imageRotate.generate(45, 'image/png').then(res=> {
  // base64
}).catch()

toBlob(dataURI: string): Blob

key desc type
dataURI(required) base64 file string
const imageRotate = new ImageRotation('your html file data')
imageRotate.generate(0, 'image/png').then(res=> {
  // base64
  const blob = imageRotate.toBlob(res)
  // blob
})

image-rotation's People

Contributors

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