h2non / bimg

Go package for fast high-level image processing powered by libvips C library
https://pkg.go.dev/github.com/h2non/bimg?tab=doc
MIT License
2.65k stars 337 forks source link

Add support for passing intent when converting color profiles #468

Open james-johnston-thumbtack opened 7 months ago

james-johnston-thumbtack commented 7 months ago

The libvips icc_transform function supports passing an intent variable, as described here: https://www.libvips.org/API/current/libvips-colour.html#vips-icc-transform

Optional arguments:

intent : VipsIntent, transform with this intent

VipsIntent looks like this:

The rendering intent. VIPS_INTENT_ABSOLUTE is best for scientific work, VIPS_INTENT_RELATIVE is usually best for accurate communication with other imaging libraries.

VIPS_INTENT_PERCEPTUAL | perceptual rendering intent VIPS_INTENT_RELATIVE | relative colorimetric rendering intent VIPS_INTENT_SATURATION | saturation rendering intent VIPS_INTENT_ABSOLUTE | absolute colorimetric rendering intent

This issue is a feature request to add support for this parameter when calling icc_transform. For example, perhaps it could be added to the Options structure at https://pkg.go.dev/github.com/h2non/bimg#Options.

This option seems to be required in order to correctly convert some CMYK images, like the example discussed here in the last comment: https://github.com/libvips/php-vips/issues/106#issuecomment-691667564