On CENTOS
yum install nginx-mod-http-image-filter
After install it .so file (module) should be located at /usr/lib64/nginx/modules/.
To load it, edit /etc/nginx/nginx.conf and place the following line at the start of the file
load_module /usr/lib64/nginx/modules/ngx_http_image_filter_module.so;