You're code snippet above seems to work for pdf's. But I'm having a similar problem converting to .png. They all end up being 72 DPI.
Using this image: https://www.dropbox.com/s/k7khbpvbrqqtryz/22307_009_%20JM_0055.jpg
Using this image: https://www.dropbox.com/s/k7khbpvbrqqtryz/22307_009_%20JM_0055.jpg
var destinationStream = new FileStream("test.png", FileMode.Create);
//this is the image in dropbox
string sourceFilePath = jpgFile;
MagickImage magickImage1 = new MagickImage(sourceFilePath);
magickImage1.Strip();
magickImage1.Format = MagickFormat.Png;
magickImage1.Density = new MagickGeometry(300, 300);
destinationStream.SetLength(0);
magickImage1.Write(destinationStream);
destinationStream.Seek(0, SeekOrigin.Begin);
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new MagickGeometry(300, 300);
settings.Format = MagickFormat.Png;
MagickImage magickImageDestination = new MagickImage(destinationStream, settings);
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)
{
}