Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes when converting images with different height or width #70

Open
flyinglionSJ opened this issue Apr 25, 2020 · 0 comments
Open

Comments

@flyinglionSJ
Copy link

Hi,

After changing inside the swiftvideogenertaor, the app crashes when convert images with different size.type = _type
audioURLs = _audios

     if self.type == .single {
       if let _image = VideoGenerator.shouldOptimiseImageForVideo ? _images.first?.resizeImageToVideoSize() : _images.first {
         self.images = [UIImage](repeating: _image, count: 2)
       }
     } else {
       
       for _image in _images {
          autoreleasepool {
            VideoGenerator.scaleHeight = CGFloat(Float(_image.getCropRatio()))
            let  height = VideoGenerator.scaleHeight
            if let imageData = _image.scaleImageToSize(newSize: CGSize(width: VideoGenerator.videoImageWidthForMultipleVideoGeneration, height: Int(CGFloat(VideoGenerator.videoImageWidthForMultipleVideoGeneration) * CGFloat(VideoGenerator.scaleHeight!))))?.pngData() {
              datasImages.append(imageData)
            }
          }
        }
        
        datasImages.forEach {
          if let imageData = $0, let image = UIImage(data: imageData, scale: UIScreen.main.scale) {
            self.images.append(image)
          }
        }
       
       datasImages.removeAll()
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant