Open aureole82 opened 1 month ago
It looks like this is caused by the ToXDocument
and FromXDocument
calls. The FromXDocument
seems to add a xml declaration (<?xml version="1.0" encoding="utf-8"?>
) that breaks the BitmapDecoder
. I just pushed a patch to remove this from the FromXDocument
method.
Does my sample project work with version 13.9.1? I get still the same issue. :-(
I tested this with a patched version of your project and that worked. Not sure why it's not working. Will take a look at this again sometime next week.
Turns out this was caused by the utf-8 byte order mark at the start of the stream. With my local testing I did something that would not cause it to be written but that did not end up in the release. It might take a while before I will publish a new release.
Magick.NET version
Magick.NET-Q16-AnyCPU 13.9.0
Environment (Operating system, version and so on)
Windows 11 23H2
Description
I have a .NET Framework 4.8 environment and need Magick.NET and old PresentationCore to work together. In general I'd like to use Magick.NET to generate images with Exif and Xmp metadata + need to make sure PresentationCore can still read this data.
Steps to Reproduce
var image = new MagickImage("sample_640x426_iptc+xmp.jpg")
var xml = image.GetXmpProfile().ToXDocument()
, optional: do some manipulation.image.SetProfile(new XmpProfile(xml))
image.ToByteArray()
BitmapMetadata
class:BitmapFrame.Create()
breaks withMagick.NET seems to corrupt the metadata so that at least Window's PresentationCore can no longer create a
BitmapMetadata
instance.Sample solution: ExifAndXmpConsole.zip