Type to search...

Gravity

Gravity provides the part of the image we want to focus on.

gravity

You can specify multiple values; the most successful (executable) version is going to be the valid one (e.g.: if there is no face on the image, it will skip to the next one, if there is a next one specified).

  • with layers (over, under, text) it provides the anchor point of the paste. In this case, the x, y values should be interpreted s starting from the anchor points, and the positive values are always point towards the center.

Parameters

  • faces*: including all faces; crop will be overwritten, so width and height will be disregarded
  • face*: the first detected face; crop will be overwritten, width and height will be disregarded
  • face:{N}*: the Nth detected face; crop will be overwritten, width and height will be disregarded
  • eyes*: including all eyes; crop will be overwritten, width and height will be disregarded
  • top-left, tl: upper left corner
  • top-right, tr: upper right corner
  • bottom-left, bl: lower left corner
  • bottom-right, br: lower right corner
  • left, l: center of left side
  • right, r: center of right side
  • bottom, b: center of bottom
  • top: center of upper part
  • center: center (default)
  • xy-center: center for X,Y points; the specification of x and y points are mandatory

*: beta version

Limitations

  • This transformation does not have any limitations.

Dependencies

Examples

Find the face and focus on it

g:face/wh:100
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->gFace()->group()->size(100);

Focus on the left side

wh:300/g:left_w:120
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->size(300)->group()->gLeft()->width(120);

Focus on the bottom right side

w:300/g:br_wh:100
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(300)->group()->gBottomRight()->size(100);

Focus on the given X,Y points

w:500/c:crop_g:xy-center_x:140_y:230_w:120_h:60
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(500)->group()->crop()->gXYCenter()->x(140)->y(230)->width(120)->height(60);

Focus on face and the top right side

w:200/g:face,tr_wh:100
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(200)->group()->gFace()->gTopRight()->size(100);

Find the face and focus on it; the height and weight is set to 100 px

g:face:3/wh:100
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->gFace(3)->group()->size(100);
Table of contents