LoginSignup
20
19

More than 5 years have passed since last update.

HTML5・Canvasを使って画像縮小したいならcanvasResizeがいい感じ

Last updated at Posted at 2013-09-26

http://qiita.com/ms2sato/items/c3cb0075138ade865bc2
にて困っていたら@kuboonさんがフォローくれました。ありがとうございます!

https://github.com/gokercebeci/canvasResize
こいつが便利なのはクロスブラウザをそれなりにしてくれている事と、MobileSafariでのバグ対応を入れてくれている事だと思います。
http://gokercebeci.com/dev/canvasresize
で試す事も出来ます。

ザックリ下記のように使える。

        <script src="js/lib/binaryajax.js"></script>
        <script src="js/lib/exif.js"></script>
        <script src="js/lib/canvasResize.js"></script>

しておいて例えば下記。

var file = //fileインスタンス
canvasResize(file, {
            width: 280,
            height: 280,
            crop: false,
            quality: 100,
            callback: function(data, width, height) {
                alert('縮小終わり');
            }
        });
    }
20
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
19