Skip to content

Instantly share code, notes, and snippets.

@idiomatic
Created May 12, 2022 23:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
console.image = function(url, scale) {
scale = scale || 1;
var img = new Image();
img.onload = function() {
const width = this.width * scale;
const height = this.height * scale;
console.log("%c+", `font-size:1px; padding:${Math.floor(height/2)}px ${Math.floor(width/2)}px; line-height:${height}px; background: url(${url}); background-size:${width}px ${height}px; color: transparent;`);
};
img.src = url;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment