> This note **WAS** *under construction*. @Victor has pointed out to my error in the pre-edited version--thank you, Victor. Now everything **is** under control and **fixed**.

Here, after @TarasBanakh, there is another example of a quotient map
$\ q: X\rightarrow X/{\sim} $ such that $X$ is compact but there is no compact subset $Y\subseteq X$ such that $f(Y)=f(X)$.

Let $Q\subset\mathbb R$ be the set of all rational numbers.
Let $\ J:=[0;1]:=\{x\in\mathbb R: 0\le x\le 1\},\ $ Define

$$ X\ :=\ \{(x\ y)\in J^2\,:\, |\{x\ y\}\cap Q| = 1\} $$

And let $\ p:X\rightarrow J\ $ be the projection $\ p(x\ y)\ := x.\ $
Then $p$ is onto, and for every $A\subseteq J$ we have:

1. $p^{-1}(A)$ is open in $X$ when $A$ is open in $J$ because $p$ is induced by the Cartesian projection;
2. $p^{-1}(A)$ is not open in $X$ when $A$ is not open in $J$ because
$p^{-1}(x)$ is dense in $\ \{x\}\times J\ $ for every $\ x\in J.\ $

Thus, $\ p\ $ is topologically equivalent to the respective quotient map.

> More than this, $p$ is an open map. Indeed, sets

> $$ B_{abcd}\ :=\ ((a;b)\times(c;d))\,\cap\, X$$

> form a topological base of $X$, and $\ p(B_{abcd}) = (a;b)\cap J.\ $ Thus $p$ is an open map.

 

Let $\ Y\subseteq X\ $ be a compact subset such that $\ p(Y)=[0;1]\ $ (a proof by contradiction). Then $\ Y\ $ is a countable union of its compact subsets $\ C_a:=(\{a\}\times\mathbb R)\cap Y\ $ and $\ D_a:=(\mathbb R\times\{a\})\cap Y,\ $ where $\ a\ $ runs over rational numbers. Then
sets $\ p(C_a)\ $ and $\ p(D_a)\ $ are compact and they cover $\ [0;1].\ $
Thus, by Baire's theorem one of these projections must have a non-empty interior in $\ [0;1]\ $ -- a contradiction. Thus such $\ Y\ $ does not exist.