Email jpg created in app including metadata

前端 未结 2 1445
天涯浪人
天涯浪人 2021-01-01 07:52

I have successfully added metadata to a jpg created within the app and saved it to the Camera Roll using the

writeImageToSavedPhotosAlbum: metadata: complet         


        
2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-01 08:31

    UIImage doesn't hold any metadata. If you have the path for the image read data directly from it. If you get the image back from camera roll there's the imagePickerController:didFinishPickingMediaWithInfo: method from UIImagePickerDelegate which also contains the metadata inside the info dictionary.

    Also the mimeType should be "image/jpeg".

    Edit: To add metadata to a UIImage you can use the ImageIO framework: You can create a CGImageDestination object from a UIImage, add metadata to it using CGImageDestinationSetProperties and then get the raw data (which includes the compressed image and the metadata) from it

提交回复
热议问题