How to scale an image (in data URI format) in JavaScript (real scaling, not using styling)

Posted by 103067513055141045393 on Stack Overflow See other posts from Stack Overflow or by 103067513055141045393
Published on 2010-03-25T14:00:17Z Indexed on 2010/03/25 14:03 UTC
Read the original article Hit count: 263

We are capturing a visible tab in a Chrome browser (by using the extensions API chrome.tabs.captureVisibleTab) and receiving a snapshot in the data URI scheme (Base64 encoded string).

Is there a JavaScript library that can be used to scale down an image to a certain size?

Currently we are styling it via CSS, but have to pay performance penalties as pictures are mostly 100 times bigger than required. Additional concern is also the load on the localStorage we use to save our snapshots.

Does anyone know of a way to process this data URI scheme formatted pictures and reduce their size by scaling them down?

References:

  • Data URI scheme on http://en.wikipedia.org/wiki/Data_URI_scheme
  • Chrome Extensions API onhttp://code.google.com/chrome/extensions/tabs.html
  • The "Recently Closed Tabs" Chrome Extension onhttp://code.google.com/p/recently-closed-tabs

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about image-manipulation