I use \includegraphics command to insert image to the document. But how can I add a border around this image w/o any margin between border lines and image? It seems to be very easy, but I can't find it in the documentation.


You can add a frame around it by placing it inside a \fbox{...} command.


The distance can be set by changing the \fboxsep length and the line width with the \fboxrule length, e.g. to draw a tight 1pt thick rule around the image use:


Using a recent version of my adjustbox package you can use:

% ...
\includegraphics[<your options>,frame]{image}% tight frame
% or 
\includegraphics[<your options>,fbox]{image}% Like normal \fbox

There is also cframe and cfbox for colored frames. All of these allow for multiple optional values, e.g. frame=<rule width>. See the manual for more information.

  • 3
    Thanks, \frame works better for me, because I don't need any margin between image and line. – TheBug Jun 13 '11 at 20:15
  • 12
    I now programmed a frame option for \includegraphics. It will be released with the next package update of adjustbox. – Martin Scharrer Jul 22 '11 at 8:16
  • 2
    Pleasen i ask if it's possible to have rounded border corners? and how ? thank you. – researcher Sep 8 '12 at 11:49
  • 1
    @researcher: For rounded corners you need to use TikZ or PS-Tricks. See also How to draw frame with rounded corners around box. – Martin Scharrer Sep 8 '12 at 12:16
  • 1
    Thanks! the frame option of adjustbox works very well! – rmbianchi Oct 1 '15 at 18:19

I've found that \frame{\includegraphics{image}} command works for my case.

  • 4
    Nice, I didn't know that \frame existed. I now figured out that beamer which defines its own \frame macro and frame environment also supports the normal \frame inside them (be saving and then restoring the default definition locally). – Martin Scharrer Jun 28 '11 at 17:25
  • 2
    Note that \frame will cause the final box to have no depth, which is fine for image but mostly not for text. {\setlength{\fboxsep}{0pt}\fbox{..}} however will keep the original depth, so that letters like 'y' and 'g' are not moved up. – Martin Scharrer Jul 22 '11 at 8:14
  • I found this to be problematic in Adobe. As you zoom in/out some sides of the box will dissapear – puk Jun 1 '20 at 23:47

You need more fancy frame? The settings that you can adjust:

\fboxsep=10mm%padding thickness
\fboxrule=4pt%border thickness



enter image description here


\fboxsep=10mm%padding thickness
\fboxrule=4pt%border thickness



\caption{This is a black box for demo purpose.}
  • 2
    Thanks for such complete example, it will help me with my next experiments. – TheBug Jun 14 '11 at 15:26

A tcbox (or a tcolorbox) were missing in this list. Some simple examples:



    \tcbox[sharp corners, boxsep=5mm, boxrule=1mm, 
            colframe=green!30!black, colback=white]

enter image description here

  • Although this is the hardest solution, it is much better than the top rate solution by @theBug – puk Jun 2 '20 at 0:05

Somebody tell me if I've missed an answer already covering this, but my favourite way to do this is using efbox and this is my go-to image-framer for simple framing.


cath sy'n gadael ei chartref

[Disclaimer: code for the image is somewhere on this site, but it's mine so I don't feel obligated to find it.]

  • 3
    Any cat seeing this must give +1. – user194703 Dec 9 '19 at 22:57
  • 1
    @Schrödinger'scat Beats example-image-a. I think the mwe package needs more cats! – cfr Dec 9 '19 at 22:59
  • 1
    How about example-image-meow? – user194703 Dec 9 '19 at 23:00
  • 1
    @Schrödinger'scat example-image-purr, example-image-silent-glare, example-image-hiss, example-image-growl, example-image-prowl ...? – cfr Dec 9 '19 at 23:03
  • I think you got the point. ;-) – user194703 Dec 9 '19 at 23:04

For someone who wants to achieve a similar affect in ConTeXt, \externalfigure accepts all the options of \framed, so one can draw a border using:


I use this command.



use example:

      \caption{Some caption text).}  

If you want to print a picture without a frame, use renewcomand in comment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.