Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

give icc_import / _export / _transform access to the new fallback profiles #1194

Closed
jcupitt opened this issue Dec 31, 2018 · 8 comments
Closed

Comments

@jcupitt
Copy link
Member

jcupitt commented Dec 31, 2018

libvips now has a built-in fallback CMYK profile for vips_CMYK2XYZ(). This should be available to vips_icc_import() etc, as well, perhaps by giving the special string cmyk as a profile filename.

We could add an sRGB fallback profile as well.

See #1186

@jcupitt
Copy link
Member Author

jcupitt commented Jan 3, 2019

There's a branch here with this added:

https://github.com/libvips/libvips/tree/add-icc-fallbacks

It includes a built-in srgb profile as well as a cmyk one. Anywhere where icc_* operations take a profile filename, you can use the case-insensitive name of one of these files (without a suffix) instead if you wish:

https://github.com/libvips/libvips/tree/add-icc-fallbacks/libvips/colour/profiles

Run it like this:

vips icc_import k2.jpg x.v --input-profile=srgb
vips icc_transform in.jpg out.jpg cmyk --input-profile=srgb

Still to do:

  • Some of the load/save operations can take profile filenames too. They should allow a fallback as well.
  • We should probably have an operation that returns a named profile as a blob. This would let language bindings add profiles with get / set.

@jcupitt
Copy link
Member Author

jcupitt commented Jan 10, 2019

Added vips_profile_load() to load a named profile. You can use profile_load from any binding.

@jcupitt
Copy link
Member Author

jcupitt commented Jan 11, 2019

And the savers all use vips_profile_load() to attach ICC profiles to images.

I think this is done!

@jcupitt
Copy link
Member Author

jcupitt commented Jan 12, 2019

OK, merged to master.

@kleisauke
Copy link
Member

Does this work for vips_icc_export?

Because this command seems to fail for me (on master):

wget https://ory.weserv.nl/zebra.jpg
vips icc_export zebra.jpg x.v --output-profile=srgb
vips__file_open_read: unable to open file "srgb" for reading
unix error: No such file or directory

@jcupitt
Copy link
Member Author

jcupitt commented Jan 17, 2019

Oh, odd, yes, it should do. I expect I messed up, I'll have a look.

@jcupitt jcupitt reopened this Jan 17, 2019
jcupitt added a commit that referenced this issue Jan 17, 2019
@jcupitt
Copy link
Member Author

jcupitt commented Jan 17, 2019

Yes, there was some code code that hadn't been moved to the new thing. Should be fixed now. Thanks!

@jcupitt jcupitt closed this as completed Jan 17, 2019
@kleisauke
Copy link
Member

It still seems to refuse to produce output via the fallback ICC profile (on master). For example:

[kleisauke@pc-kaw ~]$ wget https://github.com/lovell/sharp/raw/master/test/fixtures/cielab-dagams.tiff
[kleisauke@pc-kaw ~]$ vips colourspace cielab-dagams.tiff cielab-dagams.v srgb

(vips:30470): VIPS-WARNING **: 13:54:35.304: Incompatible type for "RichTIFFIPTC"; tag ignored
[kleisauke@pc-kaw ~]$ vips icc_transform cielab-dagams.v x.v srgb --input-profile=srgb --intent=perceptual --embedded=true

(vips:30490): VIPS-WARNING **: 13:54:41.133: profile colourspace differs from image
icc_transform: no input profile

(same output with vipsthumbnail cielab-dagams.tiff --size 128 --iprofile srgb --eprofile srgb)

This worked fine on vips 8.7.4:

[kleisauke@pc-kaw ~]$ vips colourspace cielab-dagams.tiff cielab-dagams.v srgb

(vips:9654): VIPS-WARNING **: 14:01:24.103: Incompatible type for "RichTIFFIPTC"; tag ignored
[kleisauke@pc-kaw ~]$ wget https://github.com/libvips/nip2/raw/master/share/nip2/data/sRGB.icm
[kleisauke@pc-kaw ~]$ vips icc_transform cielab-dagams.v x.v sRGB.icm --input-profile=sRGB.icm --intent=perceptual --embedded=true

(vips:9794): VIPS-WARNING **: 14:01:28.219: embedded profile colourspace differs from image

See #730 for more background information regarding this cielab-dagams.tiff image.

(I'm not sure if I had to open a new issue for this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants