Post

Replies

Boosts

Views

Activity

Reply to Inquiry Regarding File Size Differences When Migrating from ALAssetsLibrary to PHPhotoLibrary
Thank you for your response. Specifically, I replaced it as follows, but the size of tmp has approximately doubled. Since the images are for business use, I would like to import the images without changing the aspect ratio. How should I implement this? code before replacement ALAsset *asset = [self.assets objectAtIndex:cellDto.index]; ALAssetRepresentation *representation = [asset defaultRepresentation]; UIImage *orgImage = [UIImage imageWithCGImage:[representation fullScreenImage] scale:[representation scale] orientation:[representation orientation]]; NSData *tmp = [[NSData alloc] initWithData:UIImagePNGRepresentation( orgImage )] ; code after replacement PHAsset *asset = [self.assets objectAtIndex:cellDto.index]; PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init]; options.synchronous = YES; [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:PHImageManagerMaximumSize contentMode:PHImageContentModeDefault options:options resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) { UIImage *orgImage = result; NSData *tmp = [[NSData alloc] initWithData:UIImagePNGRepresentation(orgImage)]; }];
Oct ’24