Add a class to the image to fix the width and height parameters.
<img src="/image.png" class="image1" />
Now CSS using min-width/height and max-width/height:
.image1 {
max-width: 500px;
max-height:500px;
min-width: 120px;
min-height: 120px;
}
Create Functions
function mouseEffect(ele,image,className){
ele.src=image;
ele.className= className;
}
Example: