IOS Image Data Detection - HEIF or HEIC

My server does not support HEIF format. Therefore, I need to convert it to JPEG before downloading from my application.

I'm doing it:

UIImage *image = [UIImage imageWithData:imageData];                               NSData *data=UIImageJPEGRepresentation(image, 1.0);

But how can I find out what data is HEIF (or HEIC)? I can see the file: ([filePath hasSuffix:@".HEIC"] || [filePath hasSuffix:@".heic"] But I do not think this is a good answer. Is there any other solution?

+4
source share
3 answers

Both existing answers have good recommendations, but try to tell the whole story ...

UIImage . A UIImage , , UIImage . , UIImage, , .

, @Ladislav , UIImage, , UIImage , . , UIImageJPEGRepresentation , JPEG.

UIImage, UIImageJPEGRepresentation, , , .


@ScottCorscadden , UIImage (), , , , , , .

, HIEF. . nokiatech, MPEG wikipedia.

HEIF , , , , HEIF, HEIF/HEVC, . , , , . , , - JPEG 0xffd8ff , , JPEG.

, , . PHImageManager. requestImageData(for:options:resultHandler:), - : HEIF HEIC, public.heif, public.heif-standard public.heic .

( , ", ", , - , , .)

+2

, , , UIImage Data,

let data = UIImageJPEGRepresentation(image, 0.9)

, , 0.9

+1

, - JPEG PNG, , , , , , HEIF (.heic) NUL. - PHImageManager, requestImageDataForAsset:options:resultHandler, Handler NSString * _Nullable dataUTI. / WWDC ( ), , UTI kUTTypeJPEG, ( , , ).

, , , .

+1

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


All Articles