libvips/php-vips

Color deviation by 'export-profile' option in thumbnail_image

Opened this issue · 1 comments

I know that it is advised to use thumbnail() rather than thumbnail_image(), but in my case I am dependent on editing an object and have no direct path name as input.

I've noticed a behavior that I can't explain. When I run the following code, I observe that the blue color in the output shifts. This only happens when I set the export-profile option. If I leave it off the colors are fine.

$image = \Jcupitt\Vips\Image::newFromFile('blocks.png');
$image = $image->thumbnail_image(100, [
        'export-profile' => $image->interpretation,
]);
$encoded = $image->pngsave_buffer();

What surprises me is that the option should not actually change anything, as the original interpretation in the image is already srgb. And if I leave out the export-profile option, it should also be encoded also to srgb by default.

Nevertheless, it results in the color shift. What could be the reason for this?

EDIT: The script does not produce a color shift under macOS and libvips-8.16.0 but does under Debian 11 and libvips42 (8.10.5-2). Could this version difference be the reason?

Input Image

blocks

Result Image

out

EDIT: The script does not produce a color shift under macOS and libvips-8.16.0 but does under Debian 11 and libvips42 (8.10.5-2). Could this version difference be the reason?

I think so. The libvips that comes with Debian 11 is very old. You should probably build your own libvips or use the prebuilt binaries from https://github.com/kleisauke/libvips-packaging/ if you have to use that platform.