javascript

How to draw transparent image with html5 canvas element  #angularjs #reactjs

  • It’s possible if you iterate thru the canvas’ image-data and set the alpha value manually, then export the transparent image with the canvas.toDataURL method and insert it into another canvas.
  • Justin, no I want to draw a semi transparent image on top of other canvas element.
  • Stack Overflow works best with JavaScript enabled
  • I have no interest in making the entire canvas transparent.
  • Intelekshual, setting context.globalAlpha effects subsequent context.drawImages atleast in Chrome.

I am targeting google chrome. Is it possible to draw transparent images on a canvas? By transparent I mean the drawing the entire image at something like 50% opacity.

@ng_real_ninja: How to draw transparent image with html5 canvas element #angularjs #reactjs

I am targeting google chrome. Is it possible to draw transparent images on a canvas? By transparent I mean the drawing the entire image at something like 50% opacity.

Are you wanting the canvas to be transparent so that you can place it over other elements? – Justin May 26 ’10 at 21:28

Justin, no I want to draw a semi transparent image on top of other canvas element. I have no interest in making the entire canvas transparent. Intelekshual, setting context.globalAlpha effects subsequent context.drawImages atleast in Chrome. – Mr Bell May 26 ’10 at 22:34

You can do this using the globalAlpha property, like this:

And yes, it does work with images. Verified with IE 9, FF 5, Safari 5, and Chrome 12 on Win 7.

It’s possible if you iterate thru the canvas’ image-data and set the alpha value manually, then export the transparent image with the canvas.toDataURL method and insert it into another canvas.

Why is ‘C minor’ parallel to ‘Eb major’, but not to ‘D# major’?

Are there 96 million workers in the US who want a job and can’t get one?

How exactly does “/bin/[” work?

javascript

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.