Exemplo n.º 1
0
        //黑白图像上色 -- 智能识别黑白图像内容并填充色彩,使黑白图像变得鲜活。 None
        public static void ColourizeDemo(string pic)
        {
            client.Timeout = 60000;  // 修改超时时间
            var image = File.ReadAllBytes(pic);
            // 调用黑白图像上色,可能会抛出网络等异常,请使用try/catch捕获
            var      result      = client.Colourize(image);
            FileInfo fileInfo    = new FileInfo(pic);
            string   newfilename = fileInfo.DirectoryName + @"\" + fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length) + "_Colourize" + fileInfo.Extension;

            SaveBase64Image(result["image"].ToString(), newfilename);
        }