Color deviation by 'export-profile' option in thumbnail_image
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 721
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
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
Result Image
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied PHP snippet using thumbnail_image() and pngsave_buffer() on the reported libvips 8.10.5 and 8.16.0 environments, comparing the export-profile and default paths. Trace the thumbnail_image entry point and image interpretation handling. Done means the version-dependent cause is identified and the issue has a documented resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100