TITLE: Does a convex function preserve convexity of sets?
QUESTION [7 upvotes]: A convex function is defined in a way that’s a bit weird to me, as it’s defined as a function whose area above the graph of a convex set is always convex. 
Is it also true that if $f:S\to T$ is convex, then any convex set in $U\subseteq S$ maps to a convex set $f(U)\subseteq T$? This would mean a convex function is a “structure preserving map for structures on which convexity is defined”.

REPLY [5 votes]: An example of a convex function that is not continuous is $f$ defined on $[0,\infty)$ by
$$ f(x) = \cases{1 & if $x =0$\cr 0 & if $x > 0$}$$
The range of this function is $\{0,1\}$ which is not convex.