To convert heat into work, you need at least two places with different temperatures. If you take in Qhigh at temperature Thigh you must dump Qlow at temperature Tlow. The amount of work you get out of a heat engine is W = Qhigh - Qlow. The maximum amount of work you can get out of a heat engine is the amount you get out of a reversible engine.
Wmax = Qhigh(1 - Tlow/Thigh).
The efficiency of a heat engine is the ratio of the work obtained to the heat energy put in at the high temperature, e = W/Qhigh. The maximum possible efficiency emax of such an engine is