HttpImageFilterModule
m (moved NginxHttpImageFilterModule to HttpImageFilterModule: Removing Nginx prefix from page titles) |
(→Directives) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 27: | Line 27: | ||
== image_filter == | == image_filter == | ||
| − | + | <include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_image_filter_module/image_filter.txt" /> | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
Specifies the type of transformation to apply to the image, one of the below: | Specifies the type of transformation to apply to the image, one of the below: | ||
| Line 47: | Line 42: | ||
* crop: proportionally reduces the image to a specified size and trims extra edge. | * crop: proportionally reduces the image to a specified size and trims extra edge. | ||
| − | == image_filter_buffer == | + | == image_filter_buffer == |
| − | + | <include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_image_filter_module/image_filter_buffer.txt" /> | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
Sets the maximum size for reading the image. | Sets the maximum size for reading the image. | ||
| − | == image_filter_jpeg_quality == | + | == image_filter_jpeg_quality == |
| − | + | <include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_image_filter_module/image_filter_jpeg_quality.txt" /> | |
| − | ''' | + | Sets the rate of loss of information when processing the images as '''JPEG'''. The maximum recommended value is '''95'''. |
| − | + | == image_filter_sharpen == | |
| − | + | <include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_image_filter_module/image_filter_sharpen.txt" /> | |
| − | + | ||
== image_filter_transparency == | == image_filter_transparency == | ||
| − | + | <include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_image_filter_module/image_filter_transparency.txt" /> | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
This directive allows you to disable image transparency in GIF and | This directive allows you to disable image transparency in GIF and | ||
| Line 81: | Line 67: | ||
= References = | = References = | ||
| − | [http:// | + | [http://nginx.org/en/docs/http/ngx_http_image_filter_module.html Original Documentation] |
Latest revision as of 19:45, 2 May 2012
Contents |
[edit] Synopsis
Version: 0.7.54+
This module is a filter for transforming JPEG, GIF and PNG images. It is not enabled by default to enable it, provide this option to ./configure when building nginx:
--with-http_image_filter_module
libgd is required to build and run the module. We recommend using the latest version of libgd.
[edit] Example Configuration
location /img/ { proxy_pass http://backend; image_filter resize 150 100; error_page 415 = /empty; } location = /empty { empty_gif; }
[edit] Directives
[edit] image_filter
| Syntax: |
image_filter off image_filter test image_filter size image_filter rotate 90 | 180 | 270 image_filter resize width height image_filter crop width height |
| Default: | off |
| Context: | location |
| Reference: | image_filter |
Specifies the type of transformation to apply to the image, one of the below:
- test: checking that the response is indeed an image format JPEG, GIF or PNG. Otherwise, an error 415.
- size: Gives information about the image in JSON format. For example,
{ "img" : { "width": 100, "height": 100, "type": "gif" } }
Or if an error occurs,
{}
- resize: proportionally reduces the image to a specified size.
- crop: proportionally reduces the image to a specified size and trims extra edge.
[edit] image_filter_buffer
| Syntax: | image_filter_buffer size |
| Default: | 1M |
| Context: |
http server location |
| Reference: | image_filter_buffer |
Sets the maximum size for reading the image.
[edit] image_filter_jpeg_quality
| Syntax: | image_filter_jpeg_quality quality |
| Default: | 75 |
| Context: |
http server location |
| Reference: | image_filter_jpeg_quality |
Sets the rate of loss of information when processing the images as JPEG. The maximum recommended value is 95.
[edit] image_filter_sharpen
| Syntax: | image_filter_sharpen percent |
| Default: | 0 |
| Context: |
http server location |
| Reference: | image_filter_sharpen |
[edit] image_filter_transparency
| Syntax: |
image_filter_transparency on | off |
| Default: | on |
| Context: |
http server location |
| Reference: | image_filter_transparency |
This directive allows you to disable image transparency in GIF and
palette-based PNG to improve image resampling quality.
True color PNG alpha-channels are always preserved despite this setting.
Note: Grayscale PNG's are untested, but should be handled as truecolor PNGs.










