         case bottomLeft
         case bottomRight
     }
-    /// Creates a copy of the receiver that is cropped to the given rectangle.
+    /// Creates a copy of the receiver that is cropped to the given rectangle in pixels. Animated image supported.
     ///
     /// The bounds will be adjusted using `CGRectIntegral`.
     ///

        let colorSpace = CGColorSpaceCreateDeviceGray()
        guard let context = CGContext(data: nil, width: cgImage.width, height: cgImage.height, bitsPerComponent: 8, bytesPerRow: 0, space: colorSpace, bitmapInfo: CGImageAlphaInfo.none.rawValue) else { return nil }
        
        context.draw(cgImage, in: CGRect(origin: .zero, size: size))
        guard let image = context.makeImage() else { return nil }
        
        return UIImage(cgImage: image)
    }
    /// Creates a copy of the receiver image with the given color filled same as the system's
    /// temple image with tint color.

        case .leftMirrored: fallthrough
        case .right: fallthrough
        case .rightMirrored:
            context.draw(cgImage, in: CGRect(origin: .zero, size: CGSize(width: scaledHeight, height: scaledWidth)))
        default:
            context.draw(cgImage, in: CGRect(origin: .zero, size: CGSize(width: scaledWidth, height: scaledHeight)))
        }
        guard let image = context.makeImage() else { return nil }
        
        return UIImage(cgImage: image, scale: scale, orientation: .up)
    }
    /// Creates and returns a copy of the receiver image with flipped vertically.
    /// Animated image supported.
    public var verticallyFlipped: UIImage! { return _flip(horizontally: false) }
    /// Creates and returns a copy of the receiver image with flipped horizontally.
    /// Animated image supported.
    public var horizontallyFlipped: UIImage! { return _flip(horizontally: true) }
    /// Creates a copy of the receiver image by the given angle. Animated image supported.
    /// 
    /// - Parameter angle: A float value indicates the angle to rotate by.
    ///
    /// - Returns: A new image with the given angle rotated.
    public func rotate(by angle: CGFloat) -> UIImage! {
        guard !animatable else { return UIImage.animatedImage(with: self.images!.flatMap({ _img in autoreleasepool{ _img.rotate(by: angle) } }), duration: duration) }
        
        // Calculate the size of the rotated view's containing box for our drawing space.
        let transform = CGAffineTransform(rotationAngle: angle)
        let rotatedBox = CGRect(origin: .zero, size: scaledSize).applying(transform)
        // Create the bitmap context.
        UIGraphicsBeginImageContextWithOptions(rotatedBox.size, false, scale)
        defer { UIGraphicsEndImageContext() }
