         // Scales points to pxiels.
         let scaledTransparentBorderWidth = transparentBorderWidth * scale
         // If the image does not have an alpha layer, add one.
-        guard let cgImage = self.alpha.cgImage, let colorSpace = cgImage.colorSpace else { return nil }
+        guard let cgImage = self.alpha._makeCgImage(), let colorSpace = cgImage.colorSpace else { return nil }
         let cgSize  = CGSize(width: CGFloat(cgImage.width), height: CGFloat(cgImage.height))
         let bitmap  = _correct(bitmapInfo: cgImage.bitmapInfo, for: colorSpace)
         var rect    = CGRect(origin: .zero, size: cgSize).insetBy(dx: -scaledTransparentBorderWidth, dy: -scaledTransparentBorderWidth)

        // Scales points to pxiels.
        let newRect        = CGRect(origin: .zero, size: newSize).integral.scale(by: scale)
        let transposedRect = CGRect(origin: .zero, size: CGSize(width: newRect.height, height: newRect.width)).integral.scale(by: scale)
        guard let cgImage = self.cgImage, let colorSpace = cgImage.colorSpace else { return nil }
        // Build a context that's the same dimensions as the new size
        // FIXME: How to decide the right alpha info of the bitmap.
        let bitmap = _correct(bitmapInfo: cgImage.bitmapInfo, for: colorSpace)

        // Create the bitmap context.
        UIGraphicsBeginImageContextWithOptions(rotatedBox.size, false, scale)
        defer { UIGraphicsEndImageContext() }
        guard let cgImage = self._makeCgImage(), let context = UIGraphicsGetCurrentContext() else { return nil }
        // Move the origin to the middle of the image so we will rotate and scale around the center.
        context.translateBy(x: rotatedBox.width * 0.5, y: rotatedBox.height * 0.5)
        // Rotate the image context.
