awkward / Tatsi

A drop-in replacement for UIImagePickerController with the ability to select multiple images and/or videos
MIT License
110 stars 30 forks source link

Low Quality Images after Importing! #45

Closed DataManBI closed 4 years ago

DataManBI commented 4 years ago

When I select a photo from library through Tatsi, the photo will be low quality! How can I fix it?

Thanks for Answering

renssies commented 4 years ago

Can you show me the code in which you turn the PHAsset into an image?

DataManBI commented 4 years ago

Sure! Is it a problem of PHAssets?

Screenshot 2020-06-09 at 10 42 03
renssies commented 4 years ago

Well, the problem of the quality is in the PH(Caching)ImageManager. Tatsi doesn't do anything with the resolution or quality.

There are a number of problems with the code you've just shared:

The discussion on this page of the docs will help you out: https://developer.apple.com/documentation/photokit/phimagemanager/1616964-requestimage

Also on a side note: targetSize is the size in pixels I believe. This contradicts the coordinate system of iOS, the coordinate space of iOS is in points (on newer iPhones 1 point = 2 or 3 pixels).

This means that on a modern iPhone the image that gets created is 100x100 pixels and not 100x100 points. Displaying it in a UIImageView of 100x100 points will make it look like an image of 50x50 pixels that is upscaled.

DataManBI commented 4 years ago

You helped me a lot!

Thank you so much!