Can I determine if an imported ALAsset photo was taken through a screenshot?

I have an imagePickerController that is used to import photos from a library into my application.

When in ALAssetsLibraryAssetForURLResultBlock , I try to find out if the ALAsset in the block that I received in the block is a photograph taken as a screenshot or is it a “genuine” photograph taken by the camera.

I tried to go through ALAsset metadata dictionaries, but could not find any flag / indication that could fit.

Does anyone have any ideas?

+4
source share
3 answers

Well, I studied and experimented .. and the closest solution I found is based on the fact that iPhone screenshots do not give EXIF ​​records (while all the other generated photos generate them).

Therefore, as soon as the photo is selected in the collector, I check whether the photo metadata contains an EXIF ​​record, and if not, I conclude that the photo was reduced.

I found the solution "as best as possible", although it is not official.

Greetings.

0
source

For a screenshot, its UTI is always “public.png” and the same size as the screen (make sure you multiply [UIScreen scale] by the width and height of the screen), you just need to check these 2 metadata, you can easily determine the screenshot.

+2
source

Add MetaData strong> to UIImage , and save it in the photo library . The same UIImage metadata can be used to find out if there is a screenshot or not.

Contact Save_Photo_to_Album_with_Metadata

0
source

Source: https://habr.com/ru/post/1440518/


All Articles