Using Javascript, there are several methods: take a look at these tips
Java code 1
Java code 2
But you can't really stop someone who knows how to get around these. What are you really trying to prevent. Perhaps watermarking your images is a better way to go?