JS - 您可以通过的base64 code图像的宽度和高度 [英] JS - get image width and height from the base64 code

查看:369
本文介绍了JS - 您可以通过的base64 code图像的宽度和高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 IMG的base64 EN codeD ,你可以在这里找到 。我怎样才能获得的高度和它的宽度是多少?

我真的很沮丧,无法找到任何东西。

任何帮助AP preciated。非常感谢!


解决方案

  VAR I =新的图像();i.onload =功能(){
 警报(i.width +,+ i.height);
};i.src =为imageData;

I have a base64 img encoded that you can find here. How can I get the height and the width of it?

I'm really frustrated, can't find anything about.

Any help appreciated. Thanks a lot!

解决方案

var i = new Image(); 

i.onload = function(){
 alert( i.width+", "+i.height );
};

i.src = imageData; 

这篇关于JS - 您可以通过的base64 code图像的宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆