Opened 7 years ago

Closed 7 years ago

#1343 closed defect (wontfix)

ngx_http_image_filter_module loses colour profile information during resizes

Reported by: azavisha@… Owned by:
Priority: major Milestone:
Component: nginx-module Version: 1.13.x
Keywords: color profile, colour profile, ICC, image filter module Cc:
uname -a: can provide this only via private message or email
nginx -V: can provide this only via private message or email

Description

All of my images after being resized by this module lose information about their colour profile. This is a serious problem for an image manipulation module. Because of this, images can look too saturated or too pale depending on the device and browser of the end user.

For example, one of my original images has this EXIF parameter: kMDItemProfileName = "sRGB IEC61966-2.1". But it is not set in the resulting image after being resized by the NGINX module.

I use the following 4 configuration parameters for the module:

image_filter_buffer 10M;
image_filter_jpeg_quality 90;
image_filter_sharpen 10;
image_filter resize $arg_size $arg_size;

NGINX version: 1.10.3 (custom build)

Related bug report for GD library (not their fault): https://github.com/libgd/libgd/issues/136

I think you need to add additional step add manually read the old colour profile if set and write it to the new image manually. You cannot rely on GD to do this automatically. See the bottom of that related bug report page for details. This is my understanding.

Thank you!

Change History (1)

comment:1 by Maxim Dounin, 7 years ago

Resolution: wontfix
Status: newclosed

The problem here is that nginx uses libgd to parse and write appropriate image resources. And it's up to libgd to know how color profiles are expected to be added to various image formats, if any. So, unless there is appropriate support in GD, it is highly unlikely that nginx will be able implement appropriate support.

Note well that image filter module is not just an "image manipulation module", but rather a module to manipulate web images. That is, images are expected to be already prepared for use in web. Don't expect it to understand all the possible metadata as potentially available in images, including orientation and color profiles. As of now, the best available approach to ensure correct color profile handling is to convert images to sRGB, much like it is usually done when publishing images to web.

I'm closing this as "wontfix", as there isn't much we can do here without support in GD. If/when appropriate support will be available in GD, feel free to reopen this ticket if any changes in nginx will be needed to properly preserve color profile.

Note: See TracTickets for help on using tickets.