x

Open in GithubOpen in StackBlitz
@twicpics-components
Documentation

refit property

The refit property:

  • reframes the image to maximize the area occupied by the main object(s) while respecting ratio in cover mode .
  • crops the image as close as possible to the main object(s) in contain mode .

To enable refit, simply add the refit property to the TwicImg component like in <TwicImg src="image.jpg" refit/>

By default, the subject will be placed at the center of the resulting image but it is possible to align the subject with a given border by specifying an anchor .

Also by default, the subject will touch the borders of the resulting image. This can be avoided by adding padding like in <TwicImg src="image.jpg" refit="5p"/>.

Want to see more examples?

Original image + mode="cover"
refit + mode='cover'
refit + mode='cover' + anchor="left"
refit cover" + anchor="right"