当前位置:网站首页>JS to obtain basic information about the width and height of an image or Base64

JS to obtain basic information about the width and height of an image or Base64

2022-06-29 09:02:00 S Xiaoxiao s 4D smile

	let newImage = new Image()
	//  There will be src Pass in the picture address or base64
	newImage.src = base64
	// onload It's asynchronous , It can be used if it is encapsulated promise
	newImage.onload = () => {
		//  Output picture information   For example, you can get the width and height of the picture 
		console.log(newImage)
		console.log(newImage.width)
		console.log(newImage.height)
	}

原网站

版权声明
本文为[S Xiaoxiao s 4D smile]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/180/202206290818368351.html