1、网络图片
1. sources复制
① 按F12进入浏览器的开发者模式,定位图片标签;
② 鼠标置于src图片地址悬停,右键选择菜单项「在“来源”面板中显示」;
③ 跳转后可见右侧图片,鼠标悬停在图片上,右键选择菜单项“Copy image as data URI”,即复制图片base64成功,粘贴到需要的地方即可。
④ 示例图片复制后的base64码字符串。
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhwAAAECCAYAAAC1yg4KAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACHKADAAQAAAABAAABAgAAAAB15WVnAAA7vklEQVR4Ae2dCZwU1bWH763qZVYWmRmW2RBFA8MmzYCIKO5R4xoxMZq4JJpoNCbRxO2nEn2al5jV97KoUd9zSwRNoiHuCzEgIjOgwIDbQ6d7GJYBBmaY6eml6r5TIDBbd9fW3VXd/9Jmuuqee+653+2qOnWXU4xhAwEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQ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AAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAA
2. Network复制
① 按F12进入浏览器的开发者模式,Network抓取请求;
② 点击图片进入详情“预览”(preview);
③ 鼠标悬停图片上,右键选择菜单项“Copy image as data URI”,即复制图片base64成功,粘贴到需要的地方即可。
2、本地图片
1. sources复制
① 拖放本地图片到浏览器;
② 按F12进入浏览器的开发者模式;
③ 进入源码面板(Sources),点击图片,右侧即为图片base64码。
某些版本chrome的sources面板显示乱码,无法复制,如下:
可以到Network面板复制。
2. Network复制
① 按F12进入浏览器的开发者模式,Network抓取请求;
② 点击图片进入详情“预览”(preview);
③ 鼠标悬停图片上,右键选择菜单项“Copy image as data URI”,即复制图片base64成功,粘贴到需要的地方即可。