/// <summary> /// Write Metadata to the Jpeg file, with no expection handling /// </summary> private void UnhandledWriteMetadata() { List <CompareResult> changes = new List <CompareResult>(); // Compare the two PhotoMetadataTools.CompareMetadata(this.InternalPhotoMetadataInFile, this.InternalPhotoMetadata, ref changes); // Save if there have been changes to the Metadata if (changes.Count > 0) { // Set the Last Edit Date this.Metadata.FotoflyDateLastSave = DateTime.Now; this.Metadata.CreationSoftware = FotoflyAssemblyInfo.ShortBuildVersion; // Read the file using (WpfFileManager wpfFileManager = new WpfFileManager(this.FileFullName, true)) { // Copy values across PhotoMetadataTools.WriteBitmapMetadata(wpfFileManager.BitmapMetadata, this.InternalPhotoMetadata); // Save file wpfFileManager.WriteMetadata(); // Save new BitmapMetadata as MetadataInFile this.InternalPhotoMetadataInFile = PhotoMetadataTools.ReadBitmapMetadata(wpfFileManager.BitmapMetadata); } } }
/// <summary> /// Read Metadata from the Jpeg file, with no expection handling /// </summary> private void UnhandledReadMetadata() { this.InternalPhotoMetadata = new PhotoMetadata(); this.InternalPhotoMetadataInFile = new PhotoMetadata(); // Read BitmapMetadata using (WpfFileManager wpfFileManager = new WpfFileManager(this.FileFullName)) { // Copy that gets changed this.InternalPhotoMetadata = PhotoMetadataTools.ReadBitmapMetadata(wpfFileManager.BitmapMetadata, wpfFileManager.BitmapDecoder); this.InternalPhotoMetadata.ImageHeight = wpfFileManager.BitmapDecoder.Frames[0].PixelHeight; this.InternalPhotoMetadata.ImageWidth = wpfFileManager.BitmapDecoder.Frames[0].PixelWidth; // Copy saved metadata for comparisons this.InternalPhotoMetadataInFile = PhotoMetadataTools.ReadBitmapMetadata(wpfFileManager.BitmapMetadata, wpfFileManager.BitmapDecoder); this.InternalPhotoMetadataInFile.ImageHeight = wpfFileManager.BitmapDecoder.Frames[0].PixelHeight; this.InternalPhotoMetadataInFile.ImageWidth = wpfFileManager.BitmapDecoder.Frames[0].PixelWidth; } }
public static PhotoMetadata ReadBitmapMetadata(BitmapMetadata bitmapMetadata) { return(PhotoMetadataTools.ReadBitmapMetadata(bitmapMetadata, null)); }