Skip to content

Commit

Permalink
colour: use cmsFLAGS_NOOPTIMIZE to keep all precision
Browse files Browse the repository at this point in the history
Resolves: libvips#3150.
  • Loading branch information
kleisauke committed Mar 1, 2023
1 parent ecafda7 commit 389fe7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions libvips/colour/icc_transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,9 @@ vips_icc_build( VipsObject *object )

/* Use cmsFLAGS_NOCACHE to disable the 1-pixel cache and make
* calling cmsDoTransform() from multiple threads safe.
* Use cmsFLAGS_NOOPTIMIZE to ensure we keep all precision.
*/
flags = cmsFLAGS_NOCACHE;
flags = cmsFLAGS_NOCACHE | cmsFLAGS_NOOPTIMIZE;

if( icc->black_point_compensation )
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
Expand Down Expand Up @@ -1228,7 +1229,7 @@ vips_icc_transform_init( VipsIccTransform *transform )
* @out: (out): output image
* @profile_filename: use this profile
*
* Transform an image from absolute to relative colorimetry using the
* Transform an image from absolute to relative colorimetric using the
* MediaWhitePoint stored in the ICC profile.
*
* See also: vips_icc_transform(), vips_icc_import().
Expand Down
3 changes: 1 addition & 2 deletions test/test-suite/test_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,11 @@ def test_thumbnail_icc(self):
assert im.width == 290
assert im.height == 442
assert im.bands == 3
assert im.bands == 3

# the colour distance should not deviate too much
# (i.e. the embedded profile should not be ignored)
im_orig = pyvips.Image.new_from_file(JPEG_FILE)
assert im_orig.de00(im).max() < 10
assert im_orig.de00(im).max() < 11

def test_similarity(self):
im = pyvips.Image.new_from_file(JPEG_FILE)
Expand Down

0 comments on commit 389fe7b

Please sign in to comment.