1
0
Fork 0
mirror of https://github.com/voltbonn/profile-picture-generator.git synced 2024-12-22 07:45:04 +00:00

use opacity when generating the image

This commit is contained in:
thomasrosen 2021-01-21 20:56:34 +01:00
parent a69d190fe9
commit 2dd926cbbb

View file

@ -27,10 +27,10 @@ function App() {
offscreenCanvas.width = frameSize offscreenCanvas.width = frameSize
offscreenCanvas.height = frameSize offscreenCanvas.height = frameSize
const offscreenCanvas_ctx = offscreenCanvas.getContext('2d', { alpha: false })
const width = frameSize const width = frameSize
const height = (img.height / img.width) * frameSize const height = (img.height / img.width) * frameSize
const offscreenCanvas_ctx = offscreenCanvas.getContext('2d', { alpha: true })
offscreenCanvas_ctx.drawImage( offscreenCanvas_ctx.drawImage(
img, img,
(frameSize - width) / 2, (frameSize - width) / 2,