我查看了HAR个文件,Chrome用它来记录浏览会话。它是用WebInspector制作的。
对于我的会话,我想知道它与图像文件有什么关系。显然它将它们作为文本下载...我看到一个PNG记录为:
"content": {
"size": 633,
"mimeType": "image/png",
"compression": 0,
"text": "iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAMAAAAs2N9uAAAAwFBMVEUAAAD//vn/6qj/8cX/4nv/4Gj/3Fb/2Ub/+/H/+OP/5oz0nnjxg1DthDn9wxf+zA3/ywL+yAn/89LoYkjiUzzeWif+7sj8yWvaQS7wtpj9ylf1uSr/1Tj+zjz+yUn90Ibrdz/9viT+2WL/0yz8v1bTMR7mehLEuVhUruWdsJv1rQjnwStiuOtlx/9Vwv9Jvv9uyv//0Rn/7riEv8o/u/+zuXhZtetnrMs9wf9x0f9SuPib2vnM7f/y+v/4z3h61P9T93Q2AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAADjSURBVBjTLdDtcoIwEEBRDAmB1AYiWlCCLVBE/EgUsRW18v5v1Q26P8/c3ZnEsqwRQjYmDqXUca3neAy/jd+5HwTCHmDkTfA4DKczAcQ+TIcYi0Cm8XxixgNiGC+A4jiRMl0uPg0RQr9AZrDHsyR6kpOHEBVFmi6/TUUkLei8XEFUrdd1DeQU1HdQuQnEdrdX+gBEj9Jv8lIIkZxeRChpkL8RnGcnpVpDDUK5qHZnntQ/Srd7c+so4crhXP0qpfSlA3JtxOHK9Qqgb/e/4ZV2ltWm0O3l/voJ9xE9bn3fd103NP/JehnXpgX3BAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMi0wMy0xNFQxNTo0MTo0OS0wNTowMIuGhf0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTAtMTItMjJUMTM6NDI6NDctMDY6MDBvXc3SAAAAAElFTkSuQmCC"
}
我想查看PNG文件,因此我输入nano test.png
并将文本保存到文件中,从iVBOR
开始......当我用Chrome打开图像时,我得到了一张破碎的图片 - 实际上没什么。
是否还有其他步骤以这种方式重建PNG文件?
根据同一文件,原始网址为http://i.stack.imgur.com/XDJKz.png,图片应为
答案 0 :(得分:3)
text
部分是用Base64编码的图像数据。
如果您只是想在浏览器中看到它而不是使用Alexander O'Mara显示的方法将其实际转换为png文件,您只需复制text
并使用{{3}像这样:
<html><head><title></title></head>
<body>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAMAAAAs2N9uAAAAwFBMVEUAAAD//vn/6qj/8cX/4nv/4Gj/3Fb/2Ub/+/H/+OP/5oz0nnjxg1DthDn9wxf+zA3/ywL+yAn/89LoYkjiUzzeWif+7sj8yWvaQS7wtpj9ylf1uSr/1Tj+zjz+yUn90Ibrdz/9viT+2WL/0yz8v1bTMR7mehLEuVhUruWdsJv1rQjnwStiuOtlx/9Vwv9Jvv9uyv//0Rn/7riEv8o/u/+zuXhZtetnrMs9wf9x0f9SuPib2vnM7f/y+v/4z3h61P9T93Q2AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAADjSURBVBjTLdDtcoIwEEBRDAmB1AYiWlCCLVBE/EgUsRW18v5v1Q26P8/c3ZnEsqwRQjYmDqXUca3neAy/jd+5HwTCHmDkTfA4DKczAcQ+TIcYi0Cm8XxixgNiGC+A4jiRMl0uPg0RQr9AZrDHsyR6kpOHEBVFmi6/TUUkLei8XEFUrdd1DeQU1HdQuQnEdrdX+gBEj9Jv8lIIkZxeRChpkL8RnGcnpVpDDUK5qHZnntQ/Srd7c+so4crhXP0qpfSlA3JtxOHK9Qqgb/e/4ZV2ltWm0O3l/voJ9xE9bn3fd103NP/JehnXpgX3BAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMi0wMy0xNFQxNTo0MTo0OS0wNTowMIuGhf0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTAtMTItMjJUMTM6NDI6NDctMDY6MDBvXc3SAAAAAElFTkSuQmCC" alt="">
</body>
</html>
答案 1 :(得分:1)
text
字符串是编码的Base64图片。如果你把字符串的内容放在一个像这样的文本文件中。
<强>的text.txt 强>
iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAMAAAAs2N9uAAAAwFBMVEUAAAD//vn/6qj/8cX/4nv/4Gj/3Fb/2Ub/+/H/+OP/5oz0nnjxg1DthDn9wxf+zA3/ywL+yAn/89LoYkjiUzzeWif+7sj8yWvaQS7wtpj9ylf1uSr/1Tj+zjz+yUn90Ibrdz/9viT+2WL/0yz8v1bTMR7mehLEuVhUruWdsJv1rQjnwStiuOtlx/9Vwv9Jvv9uyv//0Rn/7riEv8o/u/+zuXhZtetnrMs9wf9x0f9SuPib2vnM7f/y+v/4z3h61P9T93Q2AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAADjSURBVBjTLdDtcoIwEEBRDAmB1AYiWlCCLVBE/EgUsRW18v5v1Q26P8/c3ZnEsqwRQjYmDqXUca3neAy/jd+5HwTCHmDkTfA4DKczAcQ+TIcYi0Cm8XxixgNiGC+A4jiRMl0uPg0RQr9AZrDHsyR6kpOHEBVFmi6/TUUkLei8XEFUrdd1DeQU1HdQuQnEdrdX+gBEj9Jv8lIIkZxeRChpkL8RnGcnpVpDDUK5qHZnntQ/Srd7c+so4crhXP0qpfSlA3JtxOHK9Qqgb/e/4ZV2ltWm0O3l/voJ9xE9bn3fd103NP/JehnXpgX3BAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMi0wMy0xNFQxNTo0MTo0OS0wNTowMIuGhf0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTAtMTItMjJUMTM6NDI6NDctMDY6MDBvXc3SAAAAAElFTkSuQmCC
您可以从命令行解码它。
base64 -D text.txt > decoded.png
解码的PNG与您链接的PNG相同。