I have the following code that I will put below, which is responsible for picking up the image from which the user places. In this case, the variable img
returns me only the url of the image. I wanted to get the image and see what color predominates in it.
Follow the code:
<input type="file" accept='image/*' name="imagem" id="img">
<button id="carregar" onclick="carrega()">Carregar</button>
<script type="text/javascript">
function carrega() {
var img = $('#img').val();
alert(img);
console.log('Img: '+img);
}
</script>