[patch] ngx_http_image_filter_module crop offset

Maxim Bublis b at codemonkey.ru
Fri Apr 27 10:13:08 UTC 2012


I assume it is a very common (but not solved yet) problem to tell
image_filter's crop about it's alignment.
In case we want to resize portrait images with crop (for example from
480x640 to 200x200) it is really usefull to align it on top of image
instead of aligning it in the middle and cutting out part of face
(current behavior).

There is a proposal to add image_filter_crop_offset setting with two
variables - axis x percentage offset and axis y percentage offset
(maybe it should be better called "percentage ratio" or something
image_filter_crop_offset <crop_x_offset> <crop_y_offset>;
The default and backward compatible values for both crop_x_offset and
crop_y_offset are 50. Valid values for both variables should be
between 0 and 100.
To solve problem with cropping portrait images we could simply do the
following setting - image_filter_crop_offset 50 10. It should tell
image_filter to crop 10% upside and 90% from downside.

Attached patch implements this proposal and adds support for crop offset.
Unfortunately, I have not found the way to checkout nginx_org
repository, but i'm ready to provide patch for Russian and English
documentation too.

Maxim Bublis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image_filter_crop_offset.patch
Type: application/octet-stream
Size: 6733 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20120427/358a7086/attachment-0001.obj>

More information about the nginx-devel mailing list