After reading the new code: does it work when the filename contains more than one dot? E.g: "figure1.2.eps"
After reading the new code: does it work when the filename contains more than one dot? E.g: "figure1.2.eps"