search

Home  >  Q&A  >  body text

javascript - How to compress images to a specified volume (not a specified size) on the JS side

Compress the image to within the specified size. For example, 500KB
is not the specified size. Can 200X300
be achieved? The ones I can find online are all in designated sizes.

大家讲道理大家讲道理2777 days ago627

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-19 10:21:18

    Can be implemented through Canvas, there is an open source project on Github: Portal

    Pure front-end implementation, does not rely on the backend. However, the use of Canvas and File API has higher requirements on the browser (IE6/7/8 does not need to consider orz).

    Demo address: Portal (tip: jquery uses google cdn and needs to cross the wall)

    Screenshot:

    Compression effect:

    reply
    0
  • Cancelreply