# overfull \hbox ..with figures (like to do If scale>width, use max width) [duplicate]

Well, I'm having a problem with figure.

I'm using figures like this:

\begin{figure}[!ht]
\centering

And I'd like to know if there is a way to IF the scale=1 exceeds the text width, use [max width = \textwidth]