I am writing an image crawler that scrapes the images from a Web page. This done by finding the img tag on the Web page. But recently I noticed, some img tags don't have an alt attribute in it. Is there any way to find the keywords for that particular image?
And are there any precautions for crawling the websites for images?
If there is no alt attribute in a tag, or it is empty, check fo attribute name, if not name, check for id. Well, id, when .asp or .aspx for instance, doesn't have to make sense. But, well, as a last resort, use src attribute by getting just the filename without an extension. Sometimes attribute class can also be used, but, well, I don't recomend it. Even id can be very much deceiving.
You will have trouble with JS imposed images, of course, but even that can be solved with a lot of time and will.
As for precautions, what  exactly do you mean? Check whether src is really an image or what?
Crawling and finding keywords for images without any "alt" attribute