Upload image file: is compression on client side already possible?

Posted by Chris on Pro Webmasters See other posts from Pro Webmasters or by Chris
Published on 2012-04-12T13:43:25Z Indexed on 2012/04/12 23:45 UTC
Read the original article Hit count: 220

Filed under:
|

When offering photo file uploading, usually the user will have badly compressed and huge (10+ megapixels) JPEG files from their cameras or phones. On the server side, these files will get re-compressed to something like 800x600px and JPEG quality 7 or 8.

Is it (already) possible to do that re-compression on the client side? So that I would only need to transmit some 100kB (800x600px) and not 3 MB or more. Something like:

(1) With javascript's new FileSystem API ( http://slides.html5rocks.com/#filewriter ) it would be possible to read the photo file's data into client side JS.

(2) Then it would be necessary to re-encode the JPEG data, which is possible, but I counld not find any library for that (yet). Anybody knows such a library?

(3) Last step would be to POST the re-compressed JPEG data to the server side for storage and get a URL to the stored photo file back from the server for inclusion into the client's HTML.

I am looking for some jQuery plugin, other JS library or example web page that does this.

© Pro Webmasters or respective owner

Related posts about JavaScript

Related posts about html5