Skip to content

Commit 58932dd

Browse files
committed
Add objects_position docs
1 parent 32f2648 commit 58932dd

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

docs/usage/getting_info.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,24 @@ Default: `0:0:ce`.
439439
}
440440
```
441441

442+
### Objcts position
443+
444+
```imgproxy_url_option
445+
objects_position:%type:%x_offset:%y_offset
446+
obj_pos:%type:%x_offset:%y_offset
447+
op:%type:%x_offset:%y_offset
448+
```
449+
450+
When the [crop](#crop) info option is used with the `obj`/`objw` gravity type, the `objects_position` option allows you to adjust the position of the detected objects on the crop area.
451+
452+
This option takes the same arguments as the [objects_position](./processing.mdx#objects-position) processiong option.
453+
454+
Default: `ce:0:0`
455+
456+
:::tip
457+
If you need to get info about the objects position in the original image, you should use the [detect_objects](#detect-objects) info option.
458+
:::
459+
442460
### Palette
443461

444462
:::slow[Slow]

docs/usage/processing.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,35 @@ Default: `ce:0:0`
252252
* `gravity:objw:%class_name1:%class_weight1:%class_name2:%class_weight2:...:%class_nameN:%class_weightN`: ((pro)) object-oriented gravity with weights. The same as `gravity:obj` but with custom weights for each class. You can use the `all` pseudo-class to set the weight for all the detected objects. For example, `gravity:objw:all:2:face:3` will set the weight of all the detected objects to `2` and the weight of the detected faces to `3`. The default weight is `1`.
253253
* `gravity:fp:%x:%y`: the gravity focus point. `x` and `y` are floating point numbers between 0 and 1 that define the coordinates of the center of the resulting image. Treat 0 and 1 as right/left for `x` and top/bottom for `y`.
254254

255+
### Objcts position ((pro)) {#objects-position}
256+
257+
```imgproxy_url_option
258+
objects_position:%type:%x_offset:%y_offset
259+
obj_pos:%type:%x_offset:%y_offset
260+
op:%type:%x_offset:%y_offset
261+
```
262+
263+
When imgproxy needs to cut some parts of the image, and the `obj`/`objw` gravity is used, the `objects_position` option allows you to adjust the position of the detected objects on the resulting image.
264+
265+
* `type` - specifies the position type. Available values:
266+
* `no`: north (top edge)
267+
* `so`: south (bottom edge)
268+
* `ea`: east (right edge)
269+
* `we`: west (left edge)
270+
* `noea`: north-east (top-right corner)
271+
* `nowe`: north-west (top-left corner)
272+
* `soea`: south-east (bottom-right corner)
273+
* `sowe`: south-west (bottom-left corner)
274+
* `ce`: center
275+
* `x_offset`, `y_offset` - (optional) specifies the position offset along the X and Y axes.
276+
277+
Default: `ce:0:0`
278+
279+
**Special positions**:
280+
281+
* `objects_position:fp:%x:%y`: the focus point position. `x` and `y` are floating point numbers between 0 and 1 that define the coordinates of the center of the objects' area in the resulting image. Treat 0 and 1 as right/left for `x` and top/bottom for `y`.
282+
* `objects_position:prop`: the proportional position. imgproxy will try to set object offsets in the resulting image proportional to their offsets in the original image. This position type allows the picture scene to be maintained after cropping.
283+
255284
### Crop
256285

257286
```imgproxy_url_option

0 commit comments

Comments
 (0)