Re: Резкость в модуле image filter

Igor Sysoev igor на sysoev.ru
Вт Авг 23 13:19:51 UTC 2011


On Tue, Aug 23, 2011 at 03:05:09PM +0200, Anton Kuznetsov wrote:
> nginx 1.0.5
> Makefile поправил
> 
> .if defined(WITH_HTTP_IMAGE_FILTER_MODULE)
> LIB_DEPENDS+=   gd.4:${PORTSDIR}/graphics/gd
> CONFIGURE_ARGS+=--with-http_image_filter_module
> EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_image_filter_module.c
> .endif
> 
> прилагаемый патч положил в files/extra-patch-ngx_http_image_filter_module.c
> 
> Получается вот так:
> 
> # make
> ===>  Building for nginx-1.0.5,1
> make -f objs/Makefile
> cc -c -O -pipe -march=nocona -I /usr/local/include -I src/core  -I
> src/event  -I src/event/modules  -I src/os/unix  -I objs -I src/http  -I
> src/http/modules  -o objs/src/http/modules/ngx_http_image_filter_module.o
> src/http/modules/ngx_http_image_filter_module.c
> src/http/modules/ngx_http_image_filter_module.c:130: error:
> 'ngx_http_image_filter_sharpen' undeclared here (not in a function)
> *** Error code 1

Новый патч.


-- 
Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
Index: src/http/modules/ngx_http_image_filter_module.c
===================================================================
--- src/http/modules/ngx_http_image_filter_module.c	(revision 4029)
+++ src/http/modules/ngx_http_image_filter_module.c	(working copy)
@@ -41,6 +41,7 @@
     ngx_uint_t                   height;
     ngx_uint_t                   angle;
     ngx_uint_t                   jpeg_quality;
+    ngx_uint_t                   sharpen;
 
     ngx_flag_t                   transparency;
 
@@ -124,6 +125,13 @@
       0,
       NULL },
 
+    { ngx_string("image_filter_sharpen"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_num_slot,
+      NGX_HTTP_LOC_CONF_OFFSET,
+      offsetof(ngx_http_image_filter_conf_t, sharpen),
+      NULL },
+
     { ngx_string("image_filter_transparency"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
       ngx_conf_set_flag_slot,
@@ -948,6 +956,10 @@
         gdImageColorTransparent(dst, gdImageColorExact(dst, red, green, blue));
     }
 
+    if (conf->sharpen) {
+        gdImageSharpen(dst, conf->sharpen);
+    }
+
     out = ngx_http_image_out(r, ctx->type, dst, &size);
 
     ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -1156,6 +1168,7 @@
 
     conf->filter = NGX_CONF_UNSET_UINT;
     conf->jpeg_quality = NGX_CONF_UNSET_UINT;
+    conf->sharpen = NGX_CONF_UNSET_UINT;
     conf->angle = NGX_CONF_UNSET_UINT;
     conf->transparency = NGX_CONF_UNSET;
     conf->buffer_size = NGX_CONF_UNSET_SIZE;
@@ -1187,6 +1200,8 @@
     /* 75 is libjpeg default quality */
     ngx_conf_merge_uint_value(conf->jpeg_quality, prev->jpeg_quality, 75);
 
+    ngx_conf_merge_uint_value(conf->sharpen, prev->sharpen, 0);
+
     if (conf->jqcv == NULL) {
         conf->jqcv = prev->jqcv;
     }


Подробная информация о списке рассылки nginx-ru