I'm trying to reduce the opacity of the image drawn on the canvas, but it isn't working
var img = new Image();
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext('2d');
img.src = './picture.jpg';
canvas.width = img.width;
canvas.height = img.height;
img.style.opacity = 0.5;
ctx.drawImage(img, 30, 30, canvas.width, canvas.height);