I'm a copy-editor and in my job I format papers for scientific journals. One of my task is (in some cases) to crop images to remove extra space between the images and the bounding box.

Usually I use to \fbox to visually check the amount of space between the images and the bounding box, but to do that I need to wrap each \includegraphics command with \fbox{...}.

My question is, is there a way to box all the images by default? Maybe using \usepackage[export]{adjustbox} in the preamble and pass the frame option to \includegraphics command by default.

  • Using the draft you would see how large the image is, however not the real white space
    – user31729
    Commented Jun 15, 2017 at 7:16
  • @ChristianHupfer I need to see the box "and" the image at the same time.
    – Gabriele
    Commented Jun 15, 2017 at 7:23

3 Answers 3


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





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


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.

  • Both solutions work fine for my purposes. Thanks.
    – Gabriele
    Commented Jun 15, 2017 at 7:51

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.


% Define some option

%Pass the other unknown thingies to graphicx










  • Very nice solution, but maybe a bit overkill? :)
    – Skillmon
    Commented Jun 15, 2017 at 8:28
  • 1
    @Skillmon: A toy solution ;-)
    – user31729
    Commented Jun 15, 2017 at 8:29
  • Does \includegraphics need \LetLtxMacro? It didn't appear to me that way when I checked.
    – Skillmon
    Commented Jun 15, 2017 at 8:31
  • @Skillmon: I did not check -- there's a starred variant, however. I think, I can omit it
    – user31729
    Commented Jun 15, 2017 at 8:33

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).



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

  • I expected that using \usepackage[export]{adjustbox} would allow \adjustboxset to work directly with \includegraphics. Is this not true? Commented Feb 12, 2019 at 15:04
  • 1
    @CiprianTomoiagă: No, the export option just makes the key namesspace the same so \includegraphics gets the same keys. As the key list given by \adjustboxset must be processed internally and \includegraphics (which is not changed by adjustbox) does not do this these keys only work with \adjincludegaphics or \adjustimage. I recommend the later for new documents. Commented Feb 13, 2019 at 6:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .