I've been tearing my hair out over this for the passed few days.
I have a project where I need to take a PNG that is in sRGB with a transparent background, and composite it repeatadly in a certain pattern over a background JPG. The background is in CMYK. The final output file is supposed to be in CMYK as well, with the profile stripped away. This image will then be printed, thus needs to be in CMYK.
I have everything working perfectly in terms of the actual sizing, placement, etc, but I'm having issues with color profiles. The colors in the final output file are not showing up correctly in Photoshop when inspecting it. The background itself is visually identical to the input background file, but the overlay PNG has its colors completely distorted.
Here are some sample files illustrating the problem:
https://www.dropbox.com/s/s4x36ofh5lv0v ... y.png?dl=0 - The overlay PNG in sRGB
https://www.dropbox.com/s/qoxwluv5f7g5s ... g.jpg?dl=0 - The background JPG in CMYK
https://www.dropbox.com/s/accd3hliazlkh ... t.jpg?dl=0 - The output file. Notice the colors of the lego figure are wrong.
https://www.dropbox.com/s/uhas6b1dkdst2 ... p.jpg?dl=0 - The same thing but manually created in Photoshop. Notice the colors of both layers match the input.
This is the sample command I am running (the actual command uses different sizes and repeats the image a lot more times, but this shortend sample illustrates the problem with the colors):
Code: Select all
magick -size 1024x1024 canvas:#ffffff \ \( 'sample-bg.jpg' -negate \) -composite \ sample-overlay.png -geometry +50+11 -composite \ sample-overlay.png -geometry +420+450 -composite \ -quality 100 \ -colorspace cmyk \ result.jpg
I'm seeing the same result on MacOS, Windows and Linux. Running version 7.0.8-68 Q16 x86_64 2019-10-07.
This really isn't my strongest suite and after hours of googling, looking over these forums, StackOverflow, etc, I'm definitely stuck. I've tried using -colorspace, -set colorspace, and -profiles using different ICC files, and all sorts of combinations of those paramters, but for the life of me I can't get it to treat the colors as expected.
Any pointers in the right direction would be greatly appreciated! Thanks!