# [NTG-context] feature request: clipping option for externalfigure

Vit Zyka vit.zyka at seznam.cz
Wed Apr 12 02:48:19 CEST 2006

Hans Hagen wrote:
> Vit Zyka wrote:
>
>>Hans Hagen wrote:
>>
>>
>>>� wrote:
>>>
>>>
>>>
>>>>Hello,
>>>>I would like to clip an external eps-figure as LaTeX does with the clip
>>>>option.
>>>>
>>>>Please consider the attachment as an example for en eps with white border
>>>>and the following LaTeX and ConTeXt code:
>>>>
>>>>\starttext % no clipping possible here
>>>>bla bla bla bla bla bla bla bla bla bla bla bla
>>>>
>>>>\externalfigure[test-img][width=0.5\textwidth]
>>>>
>>>>bla bla bla bla bla bla bla bla bla bla bla bla
>>>>\stoptext
>>>>
>>>>\documentclass{article}
>>>>\usepackage{graphicx}
>>>>\begin{document} % here the white border is clipped away
>>>>bla bla bla bla bla bla bla bla bla bla bla bla
>>>>
>>>>\includegraphics[clip,width=0.5\textwidth]{test-img}
>>>>
>>>>bla bla bla bla bla bla bla bla bla bla bla bla
>>>>\end{document}
>>>>
>>>>Or is there already such (undocumented) feature?
>>>>
>>>>
>>>>
>>>
>>>\clip[nx=10,ny=20,x=2,y=4]{}
>>>
>>>and alike (grep for clip)
>>>
>>>Hans
>>>
>>
>>Peter was asking for something different, I believe.
>>
>>\clip do the thing well but you have to measure a bb somewhere, e.g. in
>>GhostView. Since \externalfigure have to know bb then an option 'clip'
>>can do that without manual measuring. There might be even en extension:
>>apart from 'clip' option there could also be 'bb=10 20 100 200' option
>>for overwritting original boundingbox. Clipping a figures would be a bit
>>more strightforward.
>>
>
> i dunno what the intended effect is but here's an example
>
> \starttext
>
> \startuseMPgraphic{test}
> draw fullcircle scaled 4cm withpen pencircle scaled 1cm ;
> setbounds currentpicture to boundingbox fullcircle scaled 4cm ;
> \stopuseMPgraphic
>
> \ruledhbox{\useMPgraphic{test}}
>
> \vskip3cm
>
> \ruledhbox{\clip{\useMPgraphic{test}}}
>
> \stoptext

I see, I did not realize such simple usage of \clip (without options).
That do exactly what was thinking about. One character of typing
difference between:

\clip{\externalfigure{test}}

and

\externalfigure[clip]{test}

is not crutial:) So sorry for noise.

But as far as I know, \clip works only with left|top,width|height
params. Could right|bottom be added (assuming at least one from
left-width-right and top-height-bottom is missing - if not width|height
is ignored)? Or there is again some secret that I missed?

Vit