 <ul> <li><p><strong>Solution 1 :</strong> You have a complicated image with transparent border and don't want the transparent part to be clickable : </p> <p>Draw the image into the canvas and use <a href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData" rel="nofollow"><code>getImageData(x,y,width,height)</code></a> to check if the pixel under the click is transparent. </p></li> </ul> <p><div class="snippet" data-lang="js" data-hide="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var pointMap = [], canvas, ctx, img; $(document).ready(function () { img = $('#bodyImageFront'); img[0].onload = init; }); $(window).resize(function () { canvas.width = img[0].width; canvas.height = img[0].height; drawCanvas(); var tempArray = pointMap; pointMap = []; for (var i = 0; i &lt; tempArray.length; i++) { addPointToMap(tempArray[i]); } }); function init(){ canvas = document.createElement("canvas"); canvas.id="bodyMapFrontCanvas"; canvas.width = img[0].width; canvas.height = img[0].height; $(canvas).css('position:relative'); $(canvas).click(addPointToMap); ctx = canvas.getContext('2d'); img.parent().append(canvas); img.css('opacity:0'); drawCanvas(); } function drawCanvas() { if(!canvas) return; ctx.drawImage(img[0], 0,0,canvas.width,canvas.height); } function addPointToMap(evt) { var target = evt.target, x = evt.offsetX ? evt.offsetX : evt.pageX - target.offsetLeft, y = evt.offsetY ? evt.offsetY : evt.pageY - target.offsetTop; // get the image data of our clicked point var pointData = ctx.getImageData(x,y,1,1).data; // if its alpha channel is 0, don't go farther if(pointData[3]===0) return; ctx.fillRect(x-5, y-5, 10, 10); if(evt.type){ pointMap.push({target: target, offsetX: x, offsetY: y}); } }</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>#bodyImageFront { display:block; max-height: 75vh; max-width: 90%; height:auto; width: auto; margin-bottom: 10px; z-index:-1; position:absolute; } canvas { z-index:20; background:#AAFFAA; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;form id="mainForm"&gt; &lt;div id="canvasContainer"&gt;&lt;/div&gt; &lt;div id="bodyMapFrontContainer"&gt; &lt;img src="https://dl.dropboxusercontent.com/s/nqtih1j7vj850ff/c6RvK.png" id="bodyImageFront" crossorigin="Anonymous" /&gt; &lt;/div&gt; &lt;/form&gt;</code></pre> </div> </div> </p> <ul> <li><p><strong>Solution 2 :</strong> You really only want to draw a simple shape like in the example you gave : </p> <p>Draw this shape directly onto the canvas and use <a href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath" rel="nofollow"><code>isPointInPath()</code></a> to detect whether it should activate the click or not.</p></li> </ul> <p><div class="snippet" data-lang="js" data-hide="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var canvas = document.querySelector('canvas'), ctx = canvas.getContext('2d'); function draw(){ var w = canvas.width, h = canvas.height; ctx.fillStyle = "#5b9bd5"; ctx.beginPath(); var radius = w/3, x= canvas.width/2, y = radius, a= 11; for ( var i = 0; i &lt;= 4 * Math.PI; i += ( 4 * Math.PI ) / 5 ) { ctx.lineTo( x + radius * Math.cos(i + a), y + radius * Math.sin(i + a)); } ctx.closePath(); ctx.fill(); } function clickHandler(e){ var target = e.target, x = e.clientX, y = e.clientY; if(ctx.isPointInPath(e.clientX, e.clientY)){ ctx.fillStyle="#000"; ctx.fillRect(x-5,y-5,10,10); } } canvas.addEventListener('click', clickHandler, false); draw();</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>canvas{background:#AAFFAA;} *{margin:0; overflow: hidden;}</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;canvas height=500 width=500/&gt;</code></pre> </div> </div> </p> <ul> <li><p><strong>Solution 3:</strong> Once again you only want a simple shape, and you don't really need <code>&lt;canvas&gt;</code>: </p> <p>Draw it with <strong>svg</strong> and add the event listener only to the svg element you want to listen to.</p></li> </ul> <p><div class="snippet" data-lang="js" data-hide="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>document.getElementById('star').addEventListener('click', clickHandler, false); var svg = document.querySelector('svg'); function clickHandler(e){ var vB = svg.getBBox(), bB = svg.getBoundingClientRect(), ratio = {w:(vB.width/bB.width), h:(vB.height/bB.height)}; var x = e.clientX*ratio.w, y = e.clientY*ratio.h; var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); rect.setAttribute('x', x); rect.setAttribute('y', y); rect.setAttribute('width', 10*ratio.w); rect.setAttribute('height', 10*ratio.w); rect.setAttribute('fill', "#000"); var parent = e.target.parentNode; parent.appendChild(rect); }</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>*{margin: 0; overflow: hidden;} svg{ height: 100vh; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"&gt; &lt;rect fill="#AAFFAA" width="100" height="100"/&gt; &lt;polygon id="star" fill="#29ABE2" points="50,16.5 60.9,40.6 85.2,42.1 65.6,59.3 71.8,83.5 50,70.1 28.2,83.5 34.4,59.3 14.8,42.1 39.1,41.6 "/&gt; &lt;/svg&gt;</code></pre> </div> </div> </p>