Based on the Robots specification document, the best ways to handle it would either be via the X-Robots-Tag HTTP header technique, in which you may specify a
noindex for any URL, include files:
HTTP/1.1 200 OK
Date: Tue, 25 May 2010 21:42:43 GMT
To directly quote the documentation:
You can use the X-Robots-Tag for non-HTML files like image files where the usage of robots meta tags is not possible. Here's an example of adding a noindex X-Robots-Tag directive for images files (.png, .jpeg, .jpg, .gif) across an entire site:
<Files ~ "\.(png|jpe?g|gif)$">
Header set X-Robots-Tag "noindex"
Or to use the
noimageindex to prevent crawling of images within that page in the markup. If you had something like a User directory in which all users had their images listed, this technique could be usefull.