This project has moved and is read-only. For the latest updates, please go here.

Simple Composite producing image that looks "inverted"

Mar 6, 2015 at 8:53 PM
This should be simple enough, I thought. I really didn't change much from the code I was working with yesterday.

The two images are writing out. The background image looks fine. But the image on top looks like a negative

using (MagickImageCollection images = new MagickImageCollection())
                        string appPath = Path.GetDirectoryName(Application.ExecutablePath);
                        //add the bg image
                        MagickImage background = new MagickImage(Path.Combine(appPath, "background-V.jpg"));

                        //add the customer's image
                        MagickImage image = new MagickImage(newFile);
                        image.BorderColor = Color.White;

                        //do the composite and write over the image
                        background.Composite(image, Gravity.Center, CompositeOperator.Over);
                        string outputDir = @"c:\workspace\HFPoutput";
                            if (!Directory.Exists(outputDir))
                        background.Write(Path.Combine(outputDir, Path.GetFileName(newFile)));
Mar 6, 2015 at 8:57 PM
Can you add a link to the images you are using?
Mar 6, 2015 at 9:02 PM
Mar 6, 2015 at 9:11 PM
I was already suspecting this, one of your images is a CMYK jpeg instead of RGB. You will get this result if you mix images that have a different color space. You should probably set the ColorSpace of your background image to sRGB. And if your input can also be CMYK you might also want to change that to sRGB.