vendredi 1 juillet 2016

UIImage size variation when picked from UIImagePickerController


While picking image from UIImageController and calculating its size there is variation in image size i.e. size of image in disk is different.

Is there a way to get proper size?

What I have tried -

  1. Converting image to data using UIImagePNGReprensentation & UIImageJPEGReprensentation. The problem with this approach -

a. This approach is memory consuming, so doesn't looks good.

b. Size vary, I can understand that it convert image to data and then calculate size, so size is different.

But whatever I have searched, every accepted answers is around this only.

  1. Using ALAssetsLibrary to get the image size, but size calculated from this also doesn't match the disk size.

I have used following method - assetForURL: resultBlock:^(ALAsset *asset) failureBlock:

  1. Using CGImageRef methods CGImageGetBytesPerRow, but this also does't give desired result.

Any other approach which I have missed?


Aucun commentaire:

Enregistrer un commentaire