Description
Magick.NET version
14.2
Environment (Operating system, version and so on)
Windows
Description
We have a couple of user PNG images that appear to have density metadata that is persisted when converting to a JPG but isn't loaded when opening the image initially.
The MagickImage
initially loads the PNG with Undefined Density but then converts to 300dpi after changing the format to JPG.
I'm not familiar enough with how profiles should or shouldn't be interpreted to know the correct behavior here but it was a little surprising that it was treated differently. For us this causes one situation to render the image at 96dpi and the other to render it at 300dpi in an XPS document thus rendering ~3x smaller than expected.
This does not appear to be a regression from previous versions.
Steps to Reproduce
The following output is from the sample PNG and output code.
0x0
300x300 inch
using var image = new MagickImage(inputFile);
Console.WriteLine(image.Density.ToString());
image.Format = MagickFormat.Jpg;
var bytes = image.ToByteArray();
using var reloadedImage = new MagickImage(bytes);
Console.WriteLine(reloadedImage.Density.ToString());
Image is all red pixels to remove user data.