Image Positioning

This document explains how images are placed on a Side for printing, based on the interaction between the template's Clipping Box for the image item, and the Pack data's Image Box representing where the image should be placed underneath the canvas.

Some simple rules for starters

Just for absolute clarity this section shall define some rules and assumptions we are making going forward with this document

Firstly there are 4 areas worth considering:

  • The Print Area - This represents the area that the template will use for printing in which we wish to place our Clipping Box and our image box. This can also be thought of as an uber-clipping box - nothing placed outside this box will ever get printed.
  • The Clipping Box - This represents the viewing 'Window'. Ie the area upon a Print Area in which we can place and view an image
  • The Image Box - This is the box in which we place an image. The image box can sit fully or partially inside the clipping box, but only the parts of the image which are within the clipping box will be visible
  • Positioning - Boxes are positioned by their center point, relative to the top-left hand corner of the Print Area

These 3 areas are demonstrated in the example below

Diagram showing interaction between image box and clipping box

Note that in the images the Print Area and Clipping Box are assumed to exactly overlap each other.

Angles of Rotation

We can rotate both the image box and the clipping box independently of each other. Both start at a default position of 0 degrees rotation, and each get rotated in relation to this starting point, and not to each other.

Following are examples of rotation which should give you a clearer idea of how the image box and the clipping box relate to each others when rotating

Positive Rotation

In this example we are rotating both the clipping box and the image box by 30 degrees.

Diagram showing interaction between image box and clipping box with a positive rotation angle

As mentioned above the rotation is relative to the starting point, so rotating both boxes by the same angle ensures that they will still fit perfectly into each other.

Negative Rotation

Similarly we can rotate both by -30 degrees. This has exactly the same effect, except the rotation has happened in the opposite direction.

Diagram showing interaction between image box and clipping box with a negative rotation angle

One thing to bear in mind in that rotating by -30 degrees and rotating by 330 degrees is ultimately the same thing

Rotating Image Box but not Clipping box

In this example we have rotated the image box (represented by the red outline) by 45 degrees while the clipping box (green outline) is unrotated.

A few things to note about this example.

  • Firstly, only those parts of the image that fit in both the Image Box and the Clipping box are rendered.
  • Secondly, note the angle of the image. You can see that due to it's rotation, the actual render will be at an angle to the printed card

Rotation of a non centred image

All the examples above assume the image box is the same size as the clipping box, and that the centre point of both is the same.

However that usually not the case, and so we need to cater for non central or smaller images.

Diagram showing interaction between image box and clipping box with a non-centered image

The rule is that all image boxes are rotated around their own centre point without prejudice.

Once rotation is applied there is no snap to fit cleverness that attempts to align corners.

We start with an image quarter the size of the clipping box which is aligned in the top left hand corner.

We apply a 45 degree rotation to it. To get the result below

Diagram showing interaction between image box and clipping box with a negative rotation angle

Note that now the image is rotated, and most of the image remains within the clipping box.

If you look at the centre point of the result image, and the original image you will notice that they are exactly the same.

If we then apply another 45 degree rotation to give us a 90degree rotation we get the image below

Diagram showing interaction between image box and clipping box with a negative rotation angle

Again note that we no longer have the image tucked up against the corner, and that some of the image sits outside the clipping box. Although again you will note that the centre point is exactly the same