Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Change image quality by setting image on IGRPhotoTweakViewController #42

Open
NijoshNewAge opened this issue Jun 11, 2019 · 3 comments
Open

Comments

@NijoshNewAge
Copy link

After choosing an image from UIImagePicker, which will be passed to the IGRPhotoTweakViewController. The image will be shown in there but it loses its original quality. Does anyone have the answer?

@ikorich
Copy link
Member

ikorich commented Sep 18, 2019

uses original size
let image = info[UIImagePickerController.InfoKey.originalImage] as! UIImage

@NijoshNewAge can you provide more info?

@NijoshNewAge
Copy link
Author

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

        let mediaType = info[UIImagePickerControllerMediaType] as! NSString

        if mediaType.isEqual(to: kUTTypeImage as String) {

            var imagePicked: UIImage?

            if isEditing {

                imagePicked = info[UIImagePickerControllerEditedImage] as? UIImage

            } else {

                imagePicked = info[UIImagePickerControllerOriginalImage] as? UIImage

            }

            picker.dismiss(animated: false) {

                let imageCropViewController = UIStoryboard(name: “Main", bundle: nil).instantiateViewController(withIdentifier: "ImageCropperViewController") as! ImageCropperViewController

                imageCropViewController.image = imagePicked              

                imageCropViewController.delegate = self

                self.viewController.present(imageCropViewController, animated: true, completion: nil)

            }

        } else if mediaType.isEqual(to: kUTTypeMovie as String) {

            let videoURL = info[UIImagePickerControllerMediaURL] as! NSURL

            let thumbImage = self.createThumbImage(videoUrl: videoURL)

            delegate.finishedPickingVideo!(videoUrl: videoURL, thumbImage: thumbImage)

            self.viewController.dismiss(animated: true)

        }
    }

This was my code in that delegate. But I didn't find where that image loose its quality?.

@ikorich
Copy link
Member

ikorich commented Sep 19, 2019

please check which one info[] calls?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants