LoginSignup
0
0

More than 3 years have passed since last update.

png 1x1 gen

Last updated at Posted at 2019-08-14

demo https://codepen.io/gnjo/pen/pozgqeN
demo https://codepen.io/gnjo/pen/ZEzQmvG

function p1x1(c,w,h){
 //ex) red or #f00 or #f005 or #ff0000 or #00000000 or transparent
 let canvas=document.createElement('canvas'),ctx=canvas.getContext('2d')
 ;
 canvas.width=w||1
 canvas.height=h||1
 ctx.fillStyle=c||"#000000"
 ctx.fillRect(0,0,canvas.width,canvas.height)
 ;
 return canvas.toDataURL("image/png") //output
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0