We also provide step-by-step instructions for removing metadata from images on a range of devices and explain how you can go about changing settings to ensure no location data is stored in the first place.
In this post, we reveal more about the types of metadata associated with images and why you should remove this information. You may even be able to change the settings on your device such that limited metadata is stored by default. It’s also a good idea to remove any potentially sensitive information from images that are stored in an unsecured location such as in an unencrypted cloud platform or on the device itself. Thankfully, it’s relatively straightforward to remove metadata from images before you make them public.
If you post that image online as is, snoopers have full access to that data, causing privacy issues for the owner and subjects of the image. Depending on the device, this could include location coordinates, date, time, device model and manufacturer, and settings used to take the image. You'll find links that helped me a lot in comments inside this library where appropriate.When you take a picture, most digital devices will store at least some metadata (known as EXIF data) connected to that image. "PhotometricInterpretation" : "Removed", "ComponentsConfiguration" : "Removed",
Print("Differences:\n", (from: metadata.originalDictionary, includeValuesInDiff: false).jsonString) Let reloadedMetadata = try! SYMetadata(imageData: imageDataWithoutMetadata) Let imageDataWithoutMetadata = try! SYMetadata.stripAllMetadata(from: originalImageData) create new image data with original image data and strip all metadata "Keywords" : "Updated: beach, baywatch, LA, sunset -> Some test keywords, added by SYMetadata example app" Print("Differences:\n", (from: metadata.originalDictionary, includeValuesInDiff: true).jsonString) Let reloadedMetadata = try! SYMetadata(imageData: imageDataWithMetadata) Let imageDataWithMetadata = try! metadata.apply(to: originalImageData) Let originalImageData = try! Data(contentsOf: imageURL) create new image data with original image data and edited metadata Let metadata = try! SYMetadata(fileURL: imageURL) load metadata from original file (please handle errors, the type is SYMetadata.Error) this is available in the Example project This library DOES NOT garantee data integrity like libexif or exiv2 would. Please heavily test your app if you use this library to edit metadata, a set of test images for tests can be found in the example app. This is just a wrapper around the NSDictionary structure this framework exposes and is not perfect. This library uses ImageIO which has its own limitations and performs its own value checks. removing TIFF.artist doesn't work if Line is present)
Feel free to send a PR my way, ideally with a test case :)Ĭurrently we support 325 keys out of 628 defined keys in iOS 14.4, or about 51%. The full list is available in Keys/Unsupported.txt. ScreenshotsĪ lot of keys have been added to ImageIO since iOS 11, they are mostly about DNG, HEIC and IPTC Ext data and are not currently supported. Read and write images metadata using ImageIO and easy to use models.