chrome devtools Snippets ページにある画像サイズと半分のサイズを一覧で表示
// getImgSize.js
(function () {
"use strict";
function getFileName(filePath) {
var path = unescape(filePath);
return path.substring(path.lastIndexOf('/') + 1, path.length);
}
console.group("img data");
var imgSizes = [];
[].forEach.call(document.querySelectorAll("img"), function (i) {
imgSizes.push({
src: getFileName(i.src),
width: i.naturalWidth,
height: i.naturalHeight,
"width/2": i.naturalWidth / 2,
"height/2": i.naturalHeight / 2,
});
});
console.table(imgSizes);
console.groupEnd();
})();