How can I get a picture only, not a picture on an entire page in ConTeXt?

To get a page which is cropped to its contents use \start...\stopTeXpage. The \startTEXpage directive also acts as an implicit \starttext, so if your document is supposed to contain only a single page with a drawing, the following is enough:

\usemodule[tikz]
\startTEXpage
  \starttikzpicture
    \draw (0,0) rectangle (2,3);
  \stoptikzpicture
\stopTEXpage

If the fitted page is supposed to contain a MetaFun drawing, there is an even shorter way to do it: \start...\stopMPpage.

\startMPpage
draw fullsquare xyscaled (2cm,3cm) ;  
\stopMPpage

Tags:

Context