static XIR.Image RemoteRepresentation(CGImage image, nint width, nint height)
        {
            NSBitmapImageRep bitmap;

            if (width != image.Width || height != image.Height)
            {
                bitmap = new NSBitmapImageRep(image.Scale(new CGSize(width, height)));
            }
            else
            {
                bitmap = new NSBitmapImageRep(image);
            }

            var data = bitmap.RepresentationUsingTypeProperties(NSBitmapImageFileType.Png);

            return(new XIR.Image(
                       XIR.ImageFormat.Png,
                       data.ToArray(),
                       (int)width,
                       (int)height));
        }