On 7/1/2013 2:59 PM, Patrick Gundlach wrote:
Am 01.07.2013 um 14:32 schrieb Hans Hagen
: On 7/1/2013 1:51 PM, Patrick Gundlach wrote:
Hi,
I'd like to crop a bitmap image. How? This is my code for image inclusion:
------- \directlua{ image = img.scan{filename="hacker.jpg"} tex.box[0] = node.hpack(img.node(image)) }
\box0 -------
bbox{...} seems to work only with PDF images.
use the pdf clip operator i.e. set a path with 'l' and 'm' and then apply the operator 'W n'
where?
I mean, what is a good place to put the pdf instructions?
best pack the img in a box and then put some qQ around it with the clip at the end (the usual experimenting with origin), so basically something compatible to \pdfliteral {q clip spec} \pdfximage{...} \pdfliteral {Q} ending up in something q 0 w 0 0 m 29.99991 0 l 29.99991 39.9999 l 0 39.9999 l W n BT /F1 11.955168 Tf 1 0 0 1 -10 51.8346 Tm [<00730073>]TJ ET Q this is a clip path: x,y=10bp,20bp w,h=30bp,40bp (using text XX instead of image) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------