[Dev-luatex] How to crop bitmap images

Patrick Gundlach patrick at gundla.ch
Mon Jul 1 21:10:21 CEST 2013

Hello Hans,

> 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

that works fine, thank you very much! This is my test code now:

  a.data = "q 0 w 20 20 m 140  20 l 140 160 l 20 160 l W n "
  b.data = "Q"
  image = img.scan{filename="cow.pdf"}
  i = img.node(image)
  head = node.hpack(a)
  tex.box[0] = head



I wonder how it compares to the slightly different approach pdflatex uses (pdftex.def?). If I see it correctly the graphicx package creates an xobject/form from the bitmap and changes the bounding box there.

Thanks again!


More information about the dev-luatex mailing list