Guys
Guys

Reputation: 352

Can I detect if an imported ALAsset photo was taken via screenshot?

I have an imagePickerController that is used for importing photos from library into my app.

When in ALAssetsLibraryAssetForURLResultBlock, I'm trying to find out if the ALAsset I've got in the block is a photo taken as a screen-shot or is it a "genuine" photo, taken by the camera.

I've tried to go through the ALAsset's metadata dictionaries but couldn't find any flag / indication that might fit.

Anyone have any ideas?

Upvotes: 5

Views: 2358

Answers (3)

evanchin
evanchin

Reputation: 2048

For screenshot, its UTI is always a "public.png" and same size as screen (be sure you have multiply [UIScreen scale] on screen bounds width and height), just need to check these 2 metadata, you can easily identify screenshot.

Upvotes: 3

Guys
Guys

Reputation: 352

Well, I was researching and experimenting .. and the closest solution I've found is based on the fact that iPhone screenshots don't yield EXIF records (while all other generated photos do generate them).

Therefore, once a photo is selected in the picker, I'm checking if the photo's metadata consists an EXIF record and if it doesn't - I conclude that the photo was screenshot.

I found it's the "as good as it gets" solution for now, although it's not an official one.

Cheers.

Upvotes: 0

Paresh Navadiya
Paresh Navadiya

Reputation: 38249

Add MetaData to UIImage while saving to Photo Library. Same metadata of UIImage can be used to know if its screenshot or not.

Refer Save_Photo_to_Album_with_Metadata

Upvotes: 0

Related Questions