         
         // 三つの部分を併合する.
         UIGraphicsBeginImageContext(UIScreen.main.bounds.size)
-        topUIImage.draw(in: CGRect(x: 0, y: 0, width: screenWidth, height: 200))
-        outputUIImage.draw(in: CGRect(x: 0, y: 200, width: screenWidth, height: 100))
-        bottomUIImage.draw(in: CGRect(x: 0, y: 300, width: screenWidth, height: screenHeight - 300))
+        
+        bottomUIImage.draw(in: CGRect(x: 0, y: 0, width: screenWidth, height: 300 * screenHeight / inputImage.extent.height))
+        outputUIImage.draw(in: CGRect(x: 0, y: 300 * screenHeight / inputImage.extent.height, width: screenWidth, height: 200 * screenHeight / inputImage.extent.height))
+        topUIImage.draw(in: CGRect(x: 0, y: 500 * screenHeight / inputImage.extent.height, width: screenWidth, height: screenHeight - 500 * screenHeight / inputImage.extent.height))
+        
         guard let resultUIImage = UIGraphicsGetImageFromCurrentImageContext() else {return inputImage}
         UIGraphicsEndImageContext()
         

        
        // 変形対象部分を切る.
//        let frameVector = CIVector(x: partRect.origin.x, y: inputImage.extent.size.height - partRect.origin.y - partRect.size.height, z: partRect.size.width, w: partRect.size.height)
        let frameVector = CIVector(x: 0, y: 200, z: screenWidth, w: 100)
        guard let cropFilter = CIFilter(name: "CICrop") else { return inputImage }
        cropFilter.setDefaults()
        cropFilter.setValue(inputImage, forKeyPath: kCIInputImageKey)

        print("filter image = \(outputImage)")
        
        // 変形対象の下の部分を切る.
        let frameBottom = CIVector(x: 0, y: 500, z: inputImage.extent.size.width, w: inputImage.extent.size.height - 500)
//        let frameBottom = CIVector(x: 0, y: partRect.origin.y, z: inputImage.extent.size.width, w: inputImage.extent.size.height - partRect.origin.y)
        guard let bottomFilter = CIFilter(name: "CICrop") else {return inputImage}
        bottomFilter.setDefaults()
