Working with Annotations
Overview
Annotations in Frame.io are represented as a serialized JSON blob of drawing objects, complete with colors, coordinates, and sizes. In the blob, all quotation marks apart from the outer bounding pair are escaped with forward slashes (e.g. \"key\":\"value\"
).
There are three basic shapes — arrow, rect, and line — as well as free-hand drawing, which is outside the scope of this guide, but follows the same basic principles of serialized coordinate data.
The coordinate system
All shapes are placed on a cartesian coordinate system with an upper-left origin, and a scale of 0 to 1 on each axis.
Basic shape data
All shapes are placed on the above plane with a combination of coordinates and style data. Each shape has some common attributes, and then each has a slightly different way of addressing the coordinate system.
All attributes for distance/width/height use the same 0 to 1 scale as the main coordinate grid itself, but are generally marked from the shape’s point of origin.
In other words, if a video is being displayed in a 640x480 viewport, x=1
will equal an absolute 640px in that context. This enables annotations to scale seamlessly while maintaining their relative position as viewing screen, size, and context shift.
Note: the origin of a rect is always the upper-left corner of the shape, regardless of drawing origin.
Common attributes
Arrow
Rect
Line
Simple example: the coordinate plane
Breakdown
Complex example: lots of boxes
Breakdown
With all that in mind, it’s helpful to lay out each element in the above image to develop a clearer picture of the annotation coordinate system. Note that the size
and radius
for each of the rectangles in this example are taking the Frame.io UI defaults.