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 3, 2023
1 parent 4cfa7c0 commit de57c3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ TBD 8.14.2
- fix `strip` parameter in webpsave [jcupitt]
- earlier abort of webpsave on kill [dloebl]
- fix thumbnail of CMYK images with an embedded ICC profile [kleisauke]
- ensure ICC transforms keep all precision [kleisauke]

9/1/23 8.14.1

Expand Down
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 de57c3e

Please sign in to comment.