         // Crop out any part of the image that's larger than the thumbnail size
         // The cropped rect must be centered on the resized image
         // Round the origin points so that the size isn't altered when CGRectIntegral is later invoked
-        let croppedRect = CGRect(x: ((resizedImage.scaledWidth - sizet) * 0.5).rounded(), y: ((resizedImage.scaledHeight - sizet) * 0.5).rounded(), width: sizet, height: sizet)
+        let croppedRect = CGRect(x: ((resizedImage.size.width - sizet) * 0.5).rounded(), y: ((resizedImage.size.width - sizet) * 0.5).rounded(), width: sizet, height: sizet)
         guard let croppedImage = resizedImage.crop(to: croppedRect) else { return nil }
         var borderedImage = croppedImage
         if borderWidth > 0.0 { borderedImage = croppedImage.bordered(borderWidth) }
         
         return borderedImage.round(cornerRadius, border: borderWidth)
     }
-    /// Creates a copy of this image that is scale-aspect-fit to the thumbnail size using `ImageIO`.
+    /// Creates a copy of this image that is scale-aspect-fit to the thumbnail size using `ImageIO` in points.
     /// Animated image supported.
     ///
     /// - Parameter size: A size of thumbnail to scale-aspect-fit to.

        guard let alp_img = context.makeImage() else { return nil }
        return UIImage(cgImage: alp_img, scale: scale, orientation: imageOrientation)
    }
    /// Creates a copy of the image with a transparent border of the given size added around its edges in pixels.
    /// Animated image supported.
    ///
    /// If the image has no alpha layer, one will be added to it.

        
        // Early fatal checking.
        guard cornerRadius >= 0.0 && borderWidth >= 0.0 else { return nil }
        // Scales points to pxiels.
        let scaledCornerRadius = cornerRadius * scale
        let scaledBorderWidth  = borderWidth  * 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 }
        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: -scaledBorderWidth, dy: -scaledBorderWidth)
        rect.origin = .zero
        // Build a context that's the same dimensions as the new size
        guard let context = CGContext(data: nil, width: Int(rect.width), height: Int(rect.height), bitsPerComponent: cgImage.bitsPerComponent, bytesPerRow: 0, space: colorSpace, bitmapInfo: bitmap.rawValue) else { return nil }
        // Create a clipping path with rounded corners
        context.beginPath()
        let roundedRect = rect.insetBy(dx: scaledBorderWidth, dy: scaledBorderWidth)
        if scaledCornerRadius == 0 {
            context.addRect(roundedRect)
        } else {
            context.saveGState()
            context.translateBy(x: roundedRect.minX, y: roundedRect.minY)
            context.scaleBy(x: scaledCornerRadius, y: scaledCornerRadius)
            
            let wr = roundedRect.width  / scaledCornerRadius
            let hr = roundedRect.height / scaledCornerRadius
            
            context.move(to: CGPoint(x: wr, y: hr * 0.5))
            context.addArc(tangent1End: CGPoint(x: wr, y: hr), tangent2End: CGPoint(x: wr * 0.5, y: hr), radius: 1.0)
