So, we clone the object since it's frozen.īitmapFrame frameCopy = (BitmapFrame)() īitmapMetadata metadata = () as BitmapMetadata String ext = Path.GetExtension(filename) quality or even not have the file ready when we save, resulting in 0b of data writtenīitmapDecoder original = BitmapDecoder.Create(file, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.None) We want to preserve the pixels and cache it on load. The BitmapCreateOptions and BitmapCacheOption denote create the decoder for the original file. Using (Stream file = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) String tempName = Path.Combine(Path.GetDirectoryName(filename), Guid.NewGuid().ToString()) Public void SetUpMetadataOnImage( string filename) It’s easy to put this back in and you find a discussion about it in one of the links at the bottom. If I just changed the metadata properties it worked. I skipped the metadata.TrySave() all together since it didn’t work when I use the SetQuery method. I have only tried the code on jpeg images, and I didn’t have one with GPS coordinates in it, but in theory it should remove GPS coordinates as well. You can check them against the exif spec. Properties pertaining to the image characteristics such as width and height are skipped. It might work just as good by removing them, but with blanking the file don’t change header wise. The image is read and then loop over all exif properties, and then blank them out. I googled around, read the exif spec and came up with the code below. Since the image libraries in WPF is far superior to the ones in winforms I gave it a shot. He was developing a solution where the customer wanted all exif data to be removed from the images they provide on the web. (For my final solution check out Exif continued.)Ī colleague of mine e-mailed me with a problem he had.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |