试图保存合并的图像,但没有任何工作正常

问题描述

我已经查看了我在以前的问题中可以找到的每个示例,但没有任何效果。我通过将裁剪后的图像复制到粘贴板然后将其粘贴到另一个图像视图中来合并两个图像。效果很好,但是当我尝试保存它时,图像总是被压扁(可能是比例问题,但似乎只有垂直尺寸扭曲了。 这是在尝试保存之前组合图像的结果

enter image description here

这是将图片保存到相册后

enter image description here

图像不会停留在翻译后的位置,并且会失真。 这是我保存图像时的代码

    let fullSize:CGSize = photoView.image!.size
    let newSize:CGSize = fullSize
    let scale:CGFloat = newSize.height/fullSize.height
    let offset:CGFloat = (newSize.width - fullSize.width*scale)/2
    let offsetRect:CGRect = CGRect.init(x: offset,y: 0,width: newSize.width - offset*2,height: newSize.height)
            
    UIGraphicsBeginImageContext(newSize);
    self.photoView.image!.draw(in: offsetRect)
            
    self.copiedView.image!.draw(in: CGRect.init(x: 0,width: photoView.image!.size.width,height:photoView.image!.size.height))
    let combImage:UIImage = UIGraphicsGetimageFromCurrentimageContext()!
    UIGraphicsEndImageContext();
                
    //photoView.image = combImage
    UIImageWritetoSavedPhotosAlbum(combImage,self,#selector(image(_:didFinishSavingWithError:contextInfo:)),nil)    

感谢任何帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)