Pass frame option to \includegraphics by default?

You could redefine \includegraphics to use the frame-option like this:

\documentclass[]{article}

\usepackage[export]{adjustbox}

\let\includegraphicsbak\includegraphics
\renewcommand*{\includegraphics}[2][]{\includegraphicsbak[frame,#1]{#2}}

\begin{document}
\includegraphics[height=4cm]{example-image}
\end{document}

Another possibility is to redefine it to always use \fbox around it with

\renewcommand*{\includegraphics}[2][]{\fbox{\includegraphicsbak[#1]{#2}}}

In the latter case you'll always get the small gaps because of the \fboxsep-length (which you could reduce to 0pt but this way you might break things in the document you edit).

EDIT: You might need \LetLtxMacro for the command, take a look here for explanations of \LetLtxMacro.


A slightly different version to skillmon's solution, by defining a framed document/package option that and redefinition of includegraphics, that uses this option.

extgraphicx loads graphicx and passes the other options to that package.

This way \documentclass[frame]{article} is sufficient.

\begin{filecontents}{extgraphicx.sty}
\ProvidesPackage{extgraphicx}

\newif\ifframeused
\RequirePackage{xkeyval}
% Define some option
\define@boolkey{extgraphicx.sty}[Gin@]{frame}[true]{%
  \typeout{Used}
}

%Pass the other unknown thingies to graphicx
\DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{graphicx}}

\ProcessOptionsX*

\RequirePackage{graphicx}




\RequirePackage{xparse}


\let\graphicx@@includegraphics\includegraphics

\RenewDocumentCommand{\includegraphics}{O{}m}{%
  \begingroup
  \ifGin@frame
  \fbox{%
    \graphicx@@includegraphics[#1]{#2}%
  }%
  \else
  \graphicx@@includegraphics[#1]{#2}%    
  \fi
  \endgroup
}

\end{filecontents}



\documentclass[frame=false]{article}



\usepackage{extgraphicx}



\begin{document}
\includegraphics{ente}

\end{document}

If you use \adjincludegraphics instead of the normal \includegraphics then you can use \adjustboxset to set default keys for all images (but also all other \adjustboxs).

\documentclass{article}

\usepackage{adjustbox}

\adjustboxset*{frame=5pt} % * to add frame behind local keys, not before

\begin{document}
\adjincludegraphics[height=4cm]{example-image}
\end{document}