Image alignment

If an image has to be scaled to fit the provided dimensions, and the aspect ratio of the image does not match the dimensions, the image could end up being misaligned to the specified bounding box. The align parameter can be used to dynamically calculate the placement of the image based on its effective dimensions and the specified coordinates. The following alignment options are available:

  • NW (default) aligns the top-left corner of the image.
  • Center aligns the center of the image.
  • one of N, NE, W, E, SW, S or SE aligns to the corresponding cardinal corner of the image.

Examples are provided here.

 @(insert_image (logo; x:="2cm";
y:="2cm"))

This example places the image 2cm from the top and left edges of the paper.

@(insert_image (logo; x:="2cm"; y:="2cm";
align:="center"))

The preceding example places the center of the image 2cm from the left and top margin of the paper.

@(insert_image (logo; x:="19cm"; y:="2cm";
align:="ne"))

The preceding example places the image 2cm from the top and right edges of the paper, such as 21 cm wide, A4 sized.