Imgix APIsRendering APITextText Font Size

Text Font Size

txt-size

Sets the font size of the text, in pixels.

The value must be a number greater than 0. The default value is 12. Use txt-size[N] to override this for a specific text layer — bare txt-size applies to every layer by default.

Pixels or a Fraction

How the number is written decides its unit. A whole number such as 20 is pixels multiplied by dpr, as it has always been. A decimal written with a dot from 0 to 1 inclusive — 0.05, .5, 1.0 — is a fraction instead, and is never multiplied by dpr. Anything else, such as 2.5, is read as pixels.

So txt-size=1 is one pixel, while txt-size=1.0 is the full height of the image. One URL written with fractions therefore holds its proportions at every width and dpr.