Customize text overlay's position by setting the gravity
(g
in URLs) and the optional offset of the x
and y
. While the default text positioning ('gravity') is center
, you can place your text in any other area of the image (tip: even outside the image's boundaries).
Here's an example of the default center positioning:
Use the gravity
parameter (g
in URLs) to place your text in different areas of the image, for example - south
:
In addition, you can add the x
and y
parameters for even more accurate positioning. Here's an example of changing the text's location to the north-west corner, with a 20 pixels offset (for both 'x' and 'y'):
The text overlay can be embedded outside of the image's boundaries. This can be used, for example, for a caption text:
You can have more advanced features, like positioning the image on the automatically detected face, rotating it, and fitting the text's size to 50% (0.5
) of the detected face by setting flags
to region_relative
(fl_region_relative
in URLs) and the required percentage:
You can also set the text's dimensions to be relative to the whole image setting flags
to region
(fl_region
in URLs) and the required percentage. For example, resize the image to be 50% in width and 20% in height relative to the base image:
See this blog post for more information: Adding watermarks, credits, badges and text overlays to images