Using the following image, the color profile at the end(cp1) is null when reading after a conversion.
https://www.dropbox.com/s/hntk98bk2qp4gan/8632_168.jpg
The code is:
https://www.dropbox.com/s/hntk98bk2qp4gan/8632_168.jpg
The code is:
var destinationStream = new FileStream("test.png", FileMode.Create);
//this is the image in dropbox
string sourceFilePath = "sourceFile"
MagickImage magickImage1 = new MagickImage(sourceFilePath);
magickImage1.Strip();
magickImage1.Format = MagickFormat.Png;
magickImage1.Density = new MagickGeometry(300, 300);
destinationStream.SetLength(0);
magickImage1.Write(destinationStream);
MagickImage magickImageDestination;
destinationStream.Seek(0, SeekOrigin.Begin);
magickImageDestination = new MagickImage(destinationStream);
MagickImage magickImageSource = new MagickImage(sourceFilePath);
ColorProfile cp = magickImageSource.GetColorProfile();
if (cp != null)
{
magickImageDestination.AddProfile(cp);
}
destinationStream.SetLength(0);
try
{
magickImageDestination.Write(destinationStream);
}
catch (Exception e)
{
}
destinationStream.Seek(0, SeekOrigin.Begin);
MagickImage mi = new MagickImage(destinationStream);
ColorProfile cp1 = mi.GetColorProfile();