Extract the image from the offline html file

Please I want to be able to generate my file and extract the image from the file without opening it. As I am doing everything via command line, no access to a browser. Please how do I achieve this?