I am looking at the top comment on this page:
https://www.php.net/manual/en/imagick.setimagecolorspace.php
It has sample code for converting a CMYK image to RGB. However, there are two things I do not understand:
- It uses the
profileImagefunction twice. Once to set the profile to CMYK if the image does not currently have a profile. The second use of the function adds the RGB profile to the image. Apparently, this means that the image now has at least two image profiles attached to it.
Question 1: Why would you want the image to have both a CMYK profile and an RGB profile? What exactly is being done here? How exactly does adding a second profile convert the image from CMYK to RGB?
- The very last line in the code is using the
stripImagefunction which removes the profiles completely along with other things such as EXIF data.
Question 2: Why are we removing the profiles? Doesn't that undo everything that we just did?