How to resize a Base64 encoded Data URI PNG using javascript?

本小妞迷上赌 提交于 2019-12-03 15:23:14

You can clone image with jQuery, and as for resizing - maybe trivial changing width and height of html element?

$('.somewhere img').clone().appendTo('.elsewhere').width(16).height(16)

The Pixastic library will do that and it work surprisingly fast, even on a mobile device.

Try someting like :

    Pixastic.process(image, "resize", { "width" : 200, "height" : 200 }, function (oCanvas){ //callback code here});

I struggled though with the fact that you give it an image and it return a Canvas, took me weeks to understand what was going on !!! Now I use Canvas2Image I found somewhere on the web to get back to an image.

The maxImage plugin claims to be able to resize images. TMMV, I have not tried this myself.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!