         completionHandler: @escaping (ClassifiedImages?, WatsonError?) -> Void)
     {
         // convert UIImage to Data
-        #if swift(>=4.2)
-        guard let imageData = image.pngData() else {
+        guard let imageData = getImageData(image: image) else {
             let error = WatsonError.serialization(values: "image to data")
             completionHandler(nil, error)
             return
         }
-        #else
-        guard let imageData = UIImagePNGRepresentation(image) else {
-            let error = WatsonError.serialization(values: "image to data")
-            completionHandler(nil, error)
-            return
-        }
-        #endif
 
         self.classifyWithLocalModel(imageData: imageData, classifierIDs: classifierIDs, threshold: threshold, completionHandler: completionHandler)
     }
 
     /**
-     Save an image to a temporary location on disk.
-     The image will be compressed in an attempt to stay under the service's 10MB image size restriction.
+     Convert UIImage to Data
      */
-    private func saveToDisk(image: UIImage) throws -> URL {
-        let filename = UUID().uuidString + ".jpg"
-        let directory = NSURL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
-        guard let file = directory.appendingPathComponent(filename) else { throw WatsonError.urlEncoding(path: filename) }
-        guard let data = image.jpegData(compressionQuality: 0.75) else { throw WatsonError.serialization(values: "classify image") }
-        try data.write(to: file)
-        return file
+    private func getImageData(image: UIImage) -> Data? {
+        return image.pngData()
     }
 }
 

        image: UIImage,
        completionHandler: @escaping (WatsonResponse<DetectedFaces>?, WatsonError?) -> Void)
    {
        // save image to disk
        let file: URL
        do {
            file = try saveToDisk(image: image)
        } catch {
            let error = WatsonError.saveData
            completionHandler(nil, error)
            return
        }

        // delete image after service call
        let deleteFile = { try? FileManager.default.removeItem(at: file) }
        let completion = {
            (response: WatsonResponse<DetectedFaces>?, error: WatsonError?) in
            deleteFile()
            completionHandler(response, error)
        }

        self.detectFaces(imagesFile: file, completionHandler: completion)
    }

    /**

        acceptLanguage: String? = nil,
        completionHandler: @escaping (WatsonResponse<ClassifiedImages>?, WatsonError?) -> Void)
    {
        // convert UIImage to Data
        guard let imageData = getImageData(image: image) else {
            let error = WatsonError.serialization(values: "image to data")
            completionHandler(nil, error)
            return
        }

        self.classify(
            imagesFile: imageData,
            imagesFilename: "image.png",
            threshold: threshold,
            owners: owners,
            classifierIDs: classifierIDs,
            acceptLanguage: acceptLanguage,
            completionHandler: completionHandler
        )
    }

