Writing Metadata

The same three approaches for reading metadata apply to writing metadata as well. The file-based ImageProperties approach already supports reading and writing most of its properties, and that was shown in the “Decoding Images” section. The two BitmapProperties approaches can be used with BitmapEncoder’s BitmapProperties property. This property is of type BitmapProperties rather than BitmapPropertiesView, so it enables writing properties with its SetPropertiesAsync method as well as reading them with its GetPropertiesAsync method.

The following code can be added to the end of the UseEncoder method to write pieces of metadata into the red-blue gradient file:

BitmapPropertySet properties = new BitmapPropertySet ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.