Skip to content

Commit de57c3e

Browse files
committed
colour: use cmsFLAGS_NOOPTIMIZE to keep all precision
Resolves: #3150.
1 parent 4cfa7c0 commit de57c3e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ TBD 8.14.2
1010
- fix `strip` parameter in webpsave [jcupitt]
1111
- earlier abort of webpsave on kill [dloebl]
1212
- fix thumbnail of CMYK images with an embedded ICC profile [kleisauke]
13+
- ensure ICC transforms keep all precision [kleisauke]
1314

1415
9/1/23 8.14.1
1516

libvips/colour/icc_transform.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,9 @@ vips_icc_build( VipsObject *object )
438438

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

444445
if( icc->black_point_compensation )
445446
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
@@ -1228,7 +1229,7 @@ vips_icc_transform_init( VipsIccTransform *transform )
12281229
* @out: (out): output image
12291230
* @profile_filename: use this profile
12301231
*
1231-
* Transform an image from absolute to relative colorimetry using the
1232+
* Transform an image from absolute to relative colorimetric using the
12321233
* MediaWhitePoint stored in the ICC profile.
12331234
*
12341235
* See also: vips_icc_transform(), vips_icc_import().

test/test-suite/test_resample.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,11 @@ def test_thumbnail_icc(self):
237237
assert im.width == 290
238238
assert im.height == 442
239239
assert im.bands == 3
240-
assert im.bands == 3
241240

242241
# the colour distance should not deviate too much
243242
# (i.e. the embedded profile should not be ignored)
244243
im_orig = pyvips.Image.new_from_file(JPEG_FILE)
245-
assert im_orig.de00(im).max() < 10
244+
assert im_orig.de00(im).max() < 11
246245

247246
def test_similarity(self):
248247
im = pyvips.Image.new_from_file(JPEG_FILE)

0 commit comments

Comments
 (0)