         guard let cgImage = context.makeImage() else {
             return base
         }
+        print(base.imageOrientation.rawValue)
         let ref = useRefImage ? (refImage ?? base) : nil
         return KingfisherWrapper.image(cgImage: cgImage, scale: targetScale, refImage: ref)
+        #else
+        
+        let format = UIGraphicsImageRendererFormat.default()
+        format.scale = scale ?? self.scale
+        let renderer = UIGraphicsImageRenderer(size: size, format: format)
+        
+        var useRefImage: Bool = false
+        let image = renderer.image { rendererContext in
+            
+            let context = rendererContext.cgContext
+            if inverting { // If drawing a CGImage, we need to make context flipped.
+                context.scaleBy(x: 1.0, y: -1.0)
+                context.translateBy(x: 0, y: -size.height)
+            }
+            
+            useRefImage = draw(context)
+        }
+        if useRefImage {
+            guard let cgImage = image.cgImage else {
+                return base
+            }
+            let ref = refImage ?? base
+            return KingfisherWrapper.image(cgImage: cgImage, scale: format.scale, refImage: ref)
+        } else {
+            return image
+        }
+        #endif
     }
     
     #if os(macOS)

        }
        
        let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: size)
        return draw(to: size) { _ in
            #if os(macOS)
            base.draw(in: rect, from: .zero, operation: .copy, fraction: 1.0)
            #else

extension KingfisherWrapper where Base: KFCrossPlatformImage {
    func draw(
        to size: CGSize,
        inverting: Bool,
        scale: CGFloat? = nil,
        refImage: KFCrossPlatformImage? = nil,
        draw: (CGContext) -> Bool // Whether use the refImage (`true`) or ignore image orientation (`false`)
    ) -> KFCrossPlatformImage
    {
        #if os(macOS)
        let targetScale = scale ?? self.scale
        GraphicsContext.begin(size: size, scale: targetScale)
        guard let context = GraphicsContext.current(size: size, scale: targetScale, inverting: inverting, cgImage: cgImage) else {
