I don't agree with Fred. The general advice is "use -profile or -colorspace but not both". That is usually good advice. But here the problem is that the colour model isn't correct for the profile, so we need to correct the colour model first.
loki5100 wrote:little question, when I want to convert any image with any kind of icc profiles to a sRGB icc profile do I always need to first convert the image to sRGBColorspace color space and then later apply the icc sRGB color profile ?
Short answer: yes.
Long answer:
A colour
model defines the number of colour channels and what each channel represents. Examples: (red green blue), (hue saturation lightness), (cyan magenta yellow).
A colour
space uses a particular colour model, but additionally defines parameters (eg primaries and transfer curves) that make pixels
colorimetrically precise, so devices know exactly what colour they should show at each pixel. Example colour spaces: sRGB, CIELab, AdobeRGB.
With those definitions, IM's "-colorspace" defines a colour
space, because each one can be converted to or from the colorimetrically-defined CIELab or XYZ. IM has a finite number of builtin colorspaces, about 30. "magick -list colorspace" lists these.
"-profile" is another way to define a color space. In particular, ICC profiles are used to define colour spaces that use the (red green blue) or (cyan magenta yellow black) colour models. An infinite number can be defined. An ICC profile can be created for any colour model such as (Y Cb Cr), but I've never seen that. I've only ever seen profiles for (red green blue) and (cyan magenta yellow black).
As a general rule, when an image has an embedded profile and we want to convert to a different colour space, we should use the "-profile" operation.
IM doesn't check that the profile for an operation is consistent with the colour model of the image. That's the problem you had: an image encoded with a (Y Cb Cr) colour model but a profile that needed a (red green blue) model.
Does that answer the question?