I have looked at every example I can find in previous questions and nothing works. I am merging two images by copying a cropped image to pasteboard and then pasting it in another image view. That works fine but when I try to save it the image is always squished(may be a scale issue but it seems only the vertical size getting distorted. This is the result of combining the images before trying to save it
This is after saving the image to the photos album
The image will not stay in the translated location and it's distorted. Here is the code when I save the image
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, y: 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)
Any help is appreciated