function () { download(dataURL) };
				downloadEl.addEventListener('click', downloadFn);
			}
			img.src = canvasElement.toDataURL();
		}

		function download(url) {
			const a = document.createElement('a')
			a.href = url;
			a.download = 'webcam-passport-photo';
			document.body.appendChild(a)
			a.click()
			document.body.removeChild(a)
		}

		function resizeOutput() {
			canvasElement.style.height = `${smallestWindowDimension}px`;
			canvasElement.style.width = `${smallestWindowDimension * videoRatio}px