quartz-composer

Positioning an image in a corner


I need to position an image in the bottom-right corner of my composition without manual adjustment, such that the image remains perfectly in the corner regardless of its size.

Using an Image and an Anchor patch I can position the image such that the image center is at the bottom right. Close, but no cigar.

The Anchor patch has width and height inputs, that would server the purpose, however I see no means of getting these data from a simple image patch.enter image description here


Solution

  • You need to tell the Anchor Position the Image's size.

    1. Create an Input Splitter of type Number. Name it Width.

    2. Connect Width to the Anchor Position's Width and the Billboard's Width.

    3. Getting the Image's Height is a bit trickier since it is determined by the Width / Aspect Ratio. Create an Image Dimensions Patch and a Math Patch with the operator to division (via double click or the inspector).

    4. Connect the Width to the first input of the Math Patch and connect the Image Dimension's Aspect Ratio to the second input of a Math Patch.

    5. Connect this output, which is the Height, to the Height input of the Anchor Position Patch.