Intervals and Continuous Functions

Hello,

I'm trying to prove that if is continuous and if then or in brief the image of a closed interval is a closed interval if f is continuous and the same with an open interval. Since I'm doing this just for fun I'm wondering if the definition of a continuous function is enough to prove it?( The definition I'd use is : f is continuous at x if and only if (with .
If you can give me the full proof I'll gladly look at it !