-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Image metadata is lost when converting from AVCapturePhoto to UIIMage #72
Comments
Hey @bogdan, I agree that in some cases this can indeed be useful, I will think about how to make it part of the library without losing the simplicity of the code; we could probably return a struct ImageData as a result, containing both metadata and UIImage. As for the latter idea, I do agree that it could be useful, but it seems like we would need to think of a more abstract solution to avoid over-complicating the code; I think giving the developer the ability to customise both photo and video settings would be more suitable here. What is your opinion on this? |
Based on my research The metadata is lost somewhere during these transformations: let capturedCIImage = prepareCIImage(ciImage, parent.attributes.cameraFilters)
let capturedCGImage = prepareCGImage(capturedCIImage)
let capturedUIImage = prepareUIImage(capturedCGImage) While UIImage can be made directly from UIImage(data: photo.fileDataRepresentation()) As far as I can see, a more complex transformation currently used is to apply Here is what ChatGPT suggested, but I didn't try. I have very little swift experience to try things quickly: https://gist.github.com/bogdan/b461fb5a20aa161d10e996945db0ea20 |
I researched it a little more and found that I didn't find any way to recover metadata from
However, I see UIImage as the design issue as it enforces re-encoding. func onImageCaptured(_ action: @escaping (UIImage, MCamera.Controller) -> ()) -> Self {
config.imageCapturedAction = {
action(UIImage(data: $0)!, $1)
}
return self
}
func onImageCaptured(_ action: @escaping (Data, MCamera.Controller) -> ()) -> Self {
config.imageCapturedAction = action
return self
} Instead of the one with You may maintain two callback formats easily deprecating the previous one if you want. |
I am trying to extract the image metadata (specifically EXIF) from a photo made by the library.
I clearly see the metadata being present in
AVCapturePhoto
internally in the library.But I can not see any metadata when working with
UIImage
object returned by the library.Is there a way to preserve the metadata?
Ideally, I would also want the metadata to include geolocation, but it seems like it is not returned by
AVCapturePhoto#capturePhoto
and there is no way to configure it but to only manually attach it:Please advice on geolocation if you want it to be part of the library or not.
The text was updated successfully, but these errors were encountered: